I created a TemplateField
in my ASP GridView, and now I want to write a small logic for a checkbox in the gridview. I am trying the FindControl
code to no success, I've used these combinations…
Dim chkChosen As CheckBox =
'GridView1.Rows(e.RowIndex).FindControl("Checkbox1")
'DirectCast(GridView1.Rows(e.RowIndex).FindControl("Checkbox1"), CheckBox).Value
'chkChosen = (CheckBox)row.FindControl("Checkbox1")
I commented them as I've used a combination of those three to no success. They all give me the same error… "RowIndex is not a Member of SystemArg…". All this is under a SelectedIndexChanged
protected sub.
Best Answer
This should work in your case: