Reputation: 17298
i used below code to fill my gridview but i need sorting gridview . How can i do that in Ado.net enttiy framework? (Sorting gridview if filling gridview with ado.net entity )
void LoadStaffPersonel()
{
int selectedDepartman = Convert.ToInt32(Request.QueryString["SelectedDepartmanID"]);
string name = "";
using (staffContext = new StaffManagementEntities())
{
name = staffContext.Departman.Where(d => d.ID == selectedDepartman).First().Name;
ObjectResult<StaffsPersonel> personalData = staffContext.GetPersonelData(name);
gvPersonel.DataSource = personalData.ToList();
gvPersonel.DataBind();
}
}
Upvotes: 1
Views: 1484
Reputation: 754983
You will need to use an "EntityDataSource" on your page, and use it to provide sorting and paging. See the MSDN Documentation for more details.
If you "materialize" your list of data by issuing a .ToList() call, you lose all those capabilities.
Upvotes: 2