I am unable to find the asp:checkbox on my asp web app using the FindControl method. I put a checkbox on my form using:
<asp:CheckBox ID="test" Text="Test checkbox" runat="server" />
In my codebehind I have the following:
Control checkbox = FindControl("test");
if (checkbox != null) Debug.Print("checkbox found");
else Debug.Print("checkbox not found");
if (test.Checked) Debug.Print("checkbox is checked");
else Debug.Print("checkbox is unchecked");
however my output (with the checkbox checked) is: checkbox not found checkbox is checked
Can somebody please tell me what I am doing wrong?