Count total rows of gridview with pagination

前端 未结 12 849
失恋的感觉
失恋的感觉 2020-12-03 12:02

I have a GridView with paging. When I try to count gridview row with gridview.rows.count, It gives me row count for current page only.

How can I get total rows of G

12条回答
  •  心在旅途
    2020-12-03 12:17

    If you are binding using the datatable or other datasource you can show the total records from the datasource. For example

      if (dtLog != null && dtLog .Rows.Count >= 0)
                {
                    lblTotal.Text = "Total " + Convert.ToString(dtLog .Rows.Count) + " records.";
                }
    

提交回复
热议问题