3

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 Search the GridView just gets the items without doing sorting on any column.

Thanks for replies!

Răzvan Flavius Panda
  • 21,730
  • 17
  • 111
  • 169

1 Answers1

6

Here is described how to reset sorting.

gridViewInstance.Sort("", SortDirection.Ascending);

maybe you will need to rebind the data.

Samich
  • 29,157
  • 6
  • 68
  • 77