protected void BindDataToGridView() { //get data from database DataTable dt = AdminDb.GetAllUsers(tbFindUser.Text, ddActiveFilter.SelectedValue); //cast to dataview for sorting and filtering DataView dv = (DataView)dt.DefaultView; //sort by session expr and direction dv.Sort = Session["SortExpr"].ToString() + Session["SortDirection"].ToString(); //rebind with new sorted data gvUsers.DataSource = dv; gvUsers.DataBind(); }
public List <UserDetails> GetAllUsers() { return(adminDb.GetAllUsers()); }