Exemple #1
0
        protected void gvUserInfo_Sorting(object sender, GridViewSortEventArgs e)
        {
            GridViewSortExpression = e.SortExpression;
            int pageIndex = 0;

            gvUserInfo.DataSource = SortDataTable(AccountData.GetUserInfo(), false);
            gvUserInfo.DataBind();
            gvUserInfo.PageIndex = pageIndex;
        }
Exemple #2
0
 protected void BindUserInfo()
 {
     try
     {
         if (Session["SortExp"] == null)
         {
             gvUserInfo.DataSource = AccountData.GetUserInfo();
             gvUserInfo.DataBind();
         }
         else
         {
             DataTable table = AccountData.GetUserInfo();
             DataView  view  = table.DefaultView;
             view.Sort             = Session["SortExp"].ToString();
             gvUserInfo.DataSource = view.ToTable();
             gvUserInfo.DataBind();
         }
     }
     catch (Exception ex)
     {
         lblErrorMsg.Text = ex.Message;
     }
 }