Click here to Skip to main content
15,668,923 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...

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:
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

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