I have a gridview that I have added some checkboxes too. I have a foreach loop that is returning if a checkbox has been clicked but I also need to pull back one of the colums in that row so I know what category is clicked.
EG: Row 1 has a category id of 3 and checkbox is unchecked. Row 2 has a category id of 12 and checkbox is unchecked. Row 3 has a category id of 23 and checkbox is checked. Row 4 has a category id of 54 and checkbox is unchecked. I can get that the row 3 is checked but I can't get back the category id to add it to the database. I'm trying something like this: foreach (GridViewRow di in GridView1.Rows) { CheckBox chkBx = (CheckBox)di.FindControl("ShowAddress"); if (chkBx != null && chkBx.Checked) // add DB code here }