How do I reset sorting for a GridView?
I have a GridView connected to an ObjectDataSource which does the sorting/paging in codebehind. Currently if I choose to sort after some column, change search parameters and then click the Search button, the GridView is still sorted after the column i selected before. In the code behind of the Search button I get the data for the GridView and then databind it.
What I need is a way to reset sorting in the OnClick method of the Search button, so that every time I click on Sea开发者_C百科rch the GridView just gets the items without doing sorting on any column.
Thanks for replies!
Here is described how to reset sorting.
gridViewInstance.Sort("", SortDirection.Ascending);
maybe you will need to rebind the data.
精彩评论