I have created a CheckBox control via the code-behind as follows:
CheckBox chkExample = new CheckBox();
chkExample.ID = "testname";
pnlMyPanel.Controls.Add(chkExample);
Howerver, I can't seem to access it when the form is submitted.
CheckBox chkNew = this.FindControl("testname") as CheckBox;
If I look at the HTML, I found the ID has the following at the beginning:
<input id="ctl00_cphdr1_cphdr3_testname" type="checkbox" name="ctl00$cphdr1$cphdr3$testname" />
This is just an example, in the actual solution I have multiple checkboxes so I can't 'hard-code' the name.
Anyone able to help?
Go to the complete details ...