The problem with setting TotalRowCount once in Page_Load is that it assumes the number of rows will remain static. Unfortunately, this is not always the case. Rows can be added, deleted, or you may have a set of controls outside of the grid which allows the user to filter and decrease the size of the selection using Ajax. After some experimentation, I suspect that, at least for RADGrid, TotalRowCount needs to be set before any of the select events (e.g. esPreSelect) are fired. This is likely why the standard ASP ObjectDataSource has "ObjectDataSource.SelectCountMethod" (in addition to ObjectDataSource.SelectMethod). So the question now is:
- Can you add a SelectCountMethod property to the esDataSource which we can wire up to a method which returns the TotalRowCount?