2
Answers

Gridview Row Count Issue

Kalyan  Reddy

Kalyan Reddy

7y
164
1
Hi Guys,
Unable to get the total count from gridview after sorting. Total Rows in DataSet- 991 but in Grid count, it says 91 but it shows all the rows in GUI. After checking few rows from Grid in Page 2 or 3. Clicking Save it shows only first page rows it's not reading other page rows.
Tired setting paging to false & page size to 5000. no use.
Can you pls help me.
Answers (2)
0
Ankit Sharma

Ankit Sharma

NA 8.8k 141k 7y
Hi kalyan
 
Please refer to this link
 
https://stackoverflow.com/questions/15129665/how-to-get-the-count-of-records-in-the-datasource-of-the-gridview 
Accepted
0
Gautam Parmar

Gautam Parmar

NA 872 2.2k 7y
Hi Kalyan,
 You may try below code whether it is paging or not once row will bind it will count...
  1. int totalRow= 0;      
  2. protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)      
  3. {      
  4.     if (e.Row.RowType == DataControlRowType.DataRow)      
  5.     {      
  6.         totalRow+=1;  
  7.     }      
  8.       
  9. }