我如何将TotalRowCount传递给DataPager

本文关键字:DataPager TotalRowCount | 更新日期: 2023-09-27 18:10:51

我到处找都没有找到正确的答案,所以我最后的办法是打扰你们。

我正在使用。net Web Forms c#和Linq。

我正在从数据库中拉回大量的记录,在本例中,它将是500k条记录。

现在我需要以最有效的方式对该数据进行分页,页面大小为50条记录。我的Ling查询将在IQueryable . skip和. take中传递,但我的asp:DataPager只带回一页数据,因为我不确定如何将TotalRowCount传递给它。

谢谢

我如何将TotalRowCount传递给DataPager

试试这个:

DataPager.TotalRowCount - Gets the total number of records that are retrieved by the underlying data source object that is referenced by the associated data-bound control.
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.datapager%28v=vs.110%29.aspx