I'm trying to locate a checkbox on my webform, but am not able to? It's always set to NULL? I have tried different approaches (the i is set via a FOR loop, I'm using a Masterpage as well):
CheckBox cb = (CheckBox)this.FindControl("ctl00_ContentPlaceHolder1_sa" + i.ToString());
CheckBox cb = (CheckBox)Page.FindControl("ctl00_ContentPlaceHolder1_sa" + i.ToString());
CheckBox cb = (CheckBox)Parent.FindControl("ctl00_ContentPlaceHolder1_sa" + i.ToString());
... as well as...
CheckBox cb = (CheckBox)this.FindControl("sa" + i.ToString());
CheckBox cb = (CheckBox)Page.FindControl("sa" + i.ToString());
CheckBox cb = (CheckBox)Parent.FindControl("sa" + i.ToString());
Any ideas?
I placed the checkboxes inside a panel, and was able to access them with Panel1.FindControl as per @linuser.
Feels like a quickfix but it works.