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

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -