2
Answers

How to get number of checked rows in a gridview using c#

Jes Sie

Jes Sie

6y
2.5k
1
Good afternoon everyone. I need a help.
 
I have a gridview and inside it is a checkbox. I want to get only the number of rows if the checkbox is checked. I tried the code below but it count the whole rows of the gridview.
 
  1. if (checkbox.Checked == true)  
  2.                     {  
  3.                         lblCheckItems.Text = GridView1.Rows.Count.ToString();  
  4.                         
  5.                     }  
 thanks for any assistance.
Answers (2)