Sorting a gridview that has paging enabled
I have a list binding on a gridview.
HistoryGrid.DataSource = objGrid;
HistoryGrid.DataBind();
AllowSorting="true" AllowPaging="True"
<asp:BoundFie开发者_StackOverflowld HeaderText="hits" DataField="numberOfHits"
SortExpression="numberOfHits" ItemStyle-HorizontalAlign="Center" />
This doesn`t work. What else do I need?
If you use a list object as DataSource
then your sorting function will not work.
You can use a DataTable as DataSource
to your Gridview and then it will work.
You can get more ideas from this thread: How to convert a GridView to DataTable and sort the DataTable?
精彩评论