Month: July 2014

Handle GridView.OnSorting() and Create a Sorting Expression using LinQ

GridView control from ASP.NET 2.0 like this one is widely used: <asp:GridViewrunat=”server”ID=”gridPersons”AutoGenerateColumns=”false”AllowSorting=”true”OnSorting=”gridPersons_Sorting”><Columns><asp:BoundFieldHeaderText=”First name”DataField=”FirstName”SortExpression=”FirstName”/><asp:BoundFieldHeaderText=”Last name”DataField=”LastName”SortExpression=”LastName”/></Columns></asp:GridView> protected void gridPersons_Sorting(object sender, GridViewSortEventArgs e) { string sortExpression = e.SortExpression; }   However, it has… Read more »