I\'m trying to use a DataPager to do Server Side paging. Here is my code
Exactly needed what you did - SQL server paging utilizing listview, datapager and linq data source. As you say TotalRowCount is readonly. There is also SetPageProperties method that can be used to set the total row count but that also didn't work for me.
However I managed to trick it this way. I have a dummy hidden listview with empty item template. The pager will be pointing at this dummy listview rather than the original listview. Then we need to bind the dummy listview to a dummy collection with the same number of items as in the original data source. This will ensure rendering the pager correctly. Here is the markup.
...
and code behind
var datasourceQuery = context.Properties.OrderBy(x => x.PropertyID).Skip(pdPagerBottom.StartRowIndex).Take(pdPagerBottom.PageSize);
this.lvPropertyList.DataSource = datasourceQuery;
this.lvPropertyList.DataBind();
this.lvDummy.DataSource = new List(Enumerable.Range(0, context.Properties.Count()));
this.lvDummy.DataBind();
Tested it with 100k records. Works a treat.