Hi,
We're having a problem with sorting when we turn the viewstate off for the RadgGrid.
When the viewstate is on (default) first the SortCommand event is fired when a user clicks on a column header to sort, giving us the possibility to alter the query that is going to be used in the NeedDataSource event to set the DataSource of the grid such that the newly requested sorting is applied. Then the NeedDataSource event fires (which uses the query that has been altered in de SortCommand event handler so that the requested sorting is applied).
However, when we turn viewstate off first the NeedDataSource event is handled, using a query that applies the sorting as it was when a user clicked a column header to change the sorting because the query has not yet been altered by the SortCommand event handler, and then the SortCommand event fires altering the query such that is applies the requested sorting but then it's to late, the query has already been used to set the grid's DataSource.
Of coarse it is possible to alter the query in the SortCommand event handler and reset the grid's DataSource, but that way the database is accessed twice of which the first is quite unnecessary.
Does anyone have an idea how to solve this problem?
Regards,
Mink
We're having a problem with sorting when we turn the viewstate off for the RadgGrid.
When the viewstate is on (default) first the SortCommand event is fired when a user clicks on a column header to sort, giving us the possibility to alter the query that is going to be used in the NeedDataSource event to set the DataSource of the grid such that the newly requested sorting is applied. Then the NeedDataSource event fires (which uses the query that has been altered in de SortCommand event handler so that the requested sorting is applied).
However, when we turn viewstate off first the NeedDataSource event is handled, using a query that applies the sorting as it was when a user clicked a column header to change the sorting because the query has not yet been altered by the SortCommand event handler, and then the SortCommand event fires altering the query such that is applies the requested sorting but then it's to late, the query has already been used to set the grid's DataSource.
Of coarse it is possible to alter the query in the SortCommand event handler and reset the grid's DataSource, but that way the database is accessed twice of which the first is quite unnecessary.
Does anyone have an idea how to solve this problem?
Regards,
Mink