开发者

Sorting a gridview that has paging enabled

开发者 https://www.devze.com 2023-03-10 04:15 出处:网络
I have a list binding on a gridview. HistoryGrid.DataSource = objGrid; HistoryGrid.DataBind(); AllowSorting=\"true\" AllowPaging=\"True\"

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消