How can I read a HTML Element like input type=checkbox from the code behind? Without adding runat="server"
. Is that possible?
How can i read a HTML Element like input type=checkbox from the code behind?
Before asking this you should first understand that HTML Elements have nothing to do with the code-behind (on the server).
You cannot access them in any way as you cannot access the client's browser from the server.
If you want to access THE VALUE of the INPUT element that is posted to the server then you should use:
var postedValue = Request.Form["nameOfElement"];
So if you have HTML:
<input type="check" name="nameOfElement" value="Yes" />
then:
postedValue
.postedValue
will be null.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With