1

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();
            }
        }

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.