How Do I Sort My GridView When Using Entity Framework

hejwkdjfme

New Member
I call my stored procedure using EF but I can't seem to figure out how to get the sorting to work when clicking a column header in my gridview. How would I go about doing so? I do have the AllowSorting = "True" set in the GridView along with the SortExpressions and OnSorting property. Here is my code:\[code\] protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { PopulateDropDownLists(); BindData(); } else { BindFilteredData(); } } private void BindData() { var query = context.GetReport(0, 0); gvReport.DataSource = query; gvReport.DataBind(); } private void BindFilteredData() { int clientId = Convert.ToInt32(Request.Form["ddClientType"]); int programId = Convert.ToInt32(Request.Form["ddProgram"]); var query = context.GetReport(clientId, programId); gvReport.DataSource = query; gvReport.DataBind(); }\[/code\]Need to implement sorting... Any help is much appreciated!
 
Back
Top