Sorting the Data when a Sortable Column's Header Hyperlink Is Clicked
At this point we have specified that the DataGrid should be sortable by checking the “Allow sorting” checkbox in the General screen of the DataGrid's Property Builder. This setting has the effect of displaying the sortable columns' headers as hyperlinks. We have also added the GetBooks() function to the ASP.NET Web page via the SELECT Data Method Code Builder and modified the function to accept a single input parameter that determines by which table column the results of the SQL query are sorted.
With these pieces in place, all that we have left to do is create an event handler for the DataGrid's SortCommand event and have the source code for this event handler retrieve the ...
Get SAMS Teach Yourself ASP.NET in 24 Hours now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.