i have created
<input type="checkbox" id="test" >
using literal..
now i want to get this control so i can check if its checked or not....
how do i find this control in the aspx.cs page?
i have created
<input type="checkbox" id="test" >
using literal..
now i want to get this control so i can check if its checked or not....
how do i find this control in the aspx.cs page?
Try Page.Controls.FindControl() or Page.YourFormNameHEre.Controls.FindControl()
Use FindControl to search for a server control for which you have specified the id parameter.
Control ctrl = FindControl("TextBox1");
If you created it programmatically as a literal, you can't use FindControl to find it. When the form posts back, you can use the form collection to see if the value posted back, as in:
Request.Form["test"] or Request["test"]
If the user doesn't check the checkbox, then the form value will not be present, which is something the uses a hidden field to work around.
HTH.