Jes Sie

Jes Sie

  • 747
  • 1.2k
  • 282.5k

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

Jun 27 2018 3:34 AM
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)