Beispiel #1
0
        private void ViewUsers()
        {
            IList <GetAccountDetails> details = new List <GetAccountDetails>();

            details = ad.ListViewUsers();

            IList <GetAccountDetails> de = details.Where(a => a.CustomerName == "ramya").ToList();
            var ga = from a in details
                     orderby a.Age ascending
                     select a;

            ViewUsersGrid.DataSource = ga;
            ViewUsersGrid.DataBind();
        }
    protected void Filling_Gridview()
    {
        try
        {
            sqlParams    = new SqlParameter[1];
            sqlParams[0] = new SqlParameter("@flag", "1");



            datast = new DataSet();
            datast = accessclass.GetDataSet("ViewUsers", CommandType.StoredProcedure, sqlParams);

            if (datast.Tables[0].Rows.Count > 0)
            {
                ViewUsersGrid.DataSourceID = null;
                ViewUsersGrid.DataSource   = datast;
                ViewUsersGrid.DataBind();
                Lbl_rc.ForeColor      = System.Drawing.Color.Black;
                Lbl_rc.Font.Bold      = true;
                Lbl_rc.Text           = "<font color='#009933'>Total no of records : " + datast.Tables[0].Rows.Count + "</font>";
                trP1.Visible          = true;
                ViewUsersGrid.Visible = true;
            }
            else
            {
                ViewUsersGrid.DataSourceID = null;
                Lbl_rc.ForeColor           = System.Drawing.Color.Black;
                Lbl_rc.Font.Bold           = true;
                Lbl_rc.Text           = "<font color='#FF0000'>No record in the list.</font>";
                trP1.Visible          = false;
                ViewUsersGrid.Visible = false;
            }
        }
        catch (Exception ex)
        {
            lblmsg.Visible = true;
            lblmsg.Text    = "Error : " + ex.Message;
        }
        finally
        {
            sqlParams = null;
            datast.Dispose();
        }
    }