Click here to Skip to main content
15,886,067 members
Please Sign up or sign in to vote.
2.33/5 (2 votes)
See more:
I want to perform some task when checkbox in grid view is checked...
How to do that??
Help me with a code snippet...
Posted

Use CheckBox OnCheckedChanged Event.

Refer the answer - gridview checkbox how to fire an event when it is checked[^]
 
Share this answer
 
 
Share this answer
 
you may try with:
C#
protected void btnSubmit_Click(object sender, EventArgs e)
 {
           int iRow = 0;
           foreach (GridViewRow row in GridView1.Rows)
           {
              CheckBox chk = (CheckBox)row.FindControl("chkApproved");
              if (chk != null && chk.Checked)
              {
                Response.Write("Checkbox is checked (GridView Row No is "+ iRow.toString() +").");
              }
              iRow = iRow + 1;                                  
           }
  }
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900