Version: 5.3.11.1116
Grid properties in aspx:
We are using custom sorting and paging, and filtering. We retrieve data via a stored procedure that returns the data sorted (but then the grid also sorts... see #2).
We are experiencing two problems:
1) Event sequence is causing 2-3 calls to the database on sorting or filtering -- first from NeedDataSource, and then from the sort or filter. This raises scalability concerns. How can we resolve? When I use the following in the NeedDataSourc event as suggested in another post, the sort doesn't happen:
if (e.RebindReason != GridRebindReason.PostbackViewStateNotPersisted)
{
LoadData(false);
}
How can we retrieve data once and only once in all scenarios (initial load, sorting, fitlering, page size change, page index change, etc.)?
2) In addition to reloading the data on sort, we are seeing an incorrect sort in at least one scenario. Our default sort is descending on a datetimeoffset datatype column. On page load, sort appears to be correct. When one clicks on that column header, it correctly sorts ascending on those dates. But when the column is clicked again to sort descending, it does not sort correctly --
e.g., it sorts a range from 12/08/2011 5:05 PM down to 12/05/2011 3:39 PM
then a range from 12/29/2011 3:33 PM down to 11/11/2011 4:58 PM,
and then a range from 01/04/2012 2:36 PM down to 01/04/2012 2:31 PM
The database is returning the data correctly sorted, so the grid is clearly resorting.
Clicking again then correclty sorts by our default descending sort. In this third state, the column now shows no sorting icon, so it's presumably correct because the grid is not resorting incorrectly at this point.
But I haven't been able to find where or why.
How can we eliminate this incorrect sort? Why & where/when (what event) is it happening?
Our LoadData() method accepts a boolean rebind parameter and calls Grid.Rebind() if true.
We have coded to the following events:
Grid properties in aspx:
<telerik:RadGrid runat="server" ID="Grid" PageSize="20" Width="100%" EnableViewState="false" CssClass="basicList">
<MasterTableView AutoGenerateColumns="false" AllowPaging="true" AllowCustomPaging="true" AllowSorting="true" DataKeyNames="ID">
We are using custom sorting and paging, and filtering. We retrieve data via a stored procedure that returns the data sorted (but then the grid also sorts... see #2).
We are experiencing two problems:
1) Event sequence is causing 2-3 calls to the database on sorting or filtering -- first from NeedDataSource, and then from the sort or filter. This raises scalability concerns. How can we resolve? When I use the following in the NeedDataSourc event as suggested in another post, the sort doesn't happen:
if (e.RebindReason != GridRebindReason.PostbackViewStateNotPersisted)
{
LoadData(false);
}
How can we retrieve data once and only once in all scenarios (initial load, sorting, fitlering, page size change, page index change, etc.)?
2) In addition to reloading the data on sort, we are seeing an incorrect sort in at least one scenario. Our default sort is descending on a datetimeoffset datatype column. On page load, sort appears to be correct. When one clicks on that column header, it correctly sorts ascending on those dates. But when the column is clicked again to sort descending, it does not sort correctly --
e.g., it sorts a range from 12/08/2011 5:05 PM down to 12/05/2011 3:39 PM
then a range from 12/29/2011 3:33 PM down to 11/11/2011 4:58 PM,
and then a range from 01/04/2012 2:36 PM down to 01/04/2012 2:31 PM
The database is returning the data correctly sorted, so the grid is clearly resorting.
Clicking again then correclty sorts by our default descending sort. In this third state, the column now shows no sorting icon, so it's presumably correct because the grid is not resorting incorrectly at this point.
But I haven't been able to find where or why.
How can we eliminate this incorrect sort? Why & where/when (what event) is it happening?
Our LoadData() method accepts a boolean rebind parameter and calls Grid.Rebind() if true.
We have coded to the following events:
Grid.PageIndexChanged: Calls LoadData(true)
Grid.PageSizeChanged: Calls LoadData(true)
Grid.SortCommand: Calls LoadData(true)
Grid.ItemCommand: Calls LoadData(false) and Grid.Rebind()
Grid.ItemDataBound
Grid.NeedDataSource: Calls LoadData(false)
Page_Load: If not a postback, calls LoadData(false)
I can send this page code privately if needed.
Thank you.