GridView - Pagination - Total Record Count
Posted on 2009-05-07
I am databinding a GridView to a DataTable, via an ObjectDataSource. I have enabled pagination and would like to display pagination data on the GUI as follows:
Displaying [Index of 1st Record on GridView.Page] - [Index of last Record on GridView.Page] of [GridView's total record count] records.
I can calculate the Index of the 1st record:
((this.GridView1.PageIndex + 1) * this.GridView1.PageSize) - (this.GridView1.PageSize - 1);
I can calcualte the Index of the Last Record displayed on the current Page:
((this.GridView1.PageIndex + 1) * this.GridView1.PageSize);
How can I calculate the total record count?