Cannot Pass values from plain HTML to ASP.NET page -
i'm using html file below (tv.html):
<form action="myaspx.aspx?appid=5018" method="post" id="formsubscription" name="formsubscription"> <input type="checkbox" id="chckisconfirm" name="chckisconfirm"/> confirm <input type="submit" value="ok" /> </form>
and trying "myaspx.aspx". , code behind is:
protected void page_load(object sender, eventargs e) { if (!ispostback) { var r = httpcontext.current.request["chckisconfirm"]; //or namevaluecollection nvc = request.form; //or var = request.form.allkeys; } }
but cannot pass value of "chckisconfirm". keys comes empty.. doing wrong?
update: when check checkbox comes "on" other times null.
thanks in advance
that's default behavior checkboxes in browsers. if it's not checked browser not send request. workaround add hidden field has same name checkbox , value "0", "off", "false" or whatever want "unchecked" value be.
Comments
Post a Comment