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
Try below code
int _TotalRecs = ((System.Data.DataView)GridView.DataSource).Count;
int _CurrentRecStart = GridView.PageIndex * GridView.PageSize + 1;
int _CurrentRecEnd = GridView.PageIndex * GridView.PageSize + GridView.Rows.Count;
lblTitle.Text = string.Format("Displaying {0} to {1} of {2} records found", _CurrentRecStart, _CurrentRecEnd, _TotalRecs);
For e.g. Output will be like below....
Displaying 1 to 15 of 67 records found.