asp.net code for retrieving posted data in html -
i have written html code posting checkbox value
<form action="default2.aspx" method="post" target="_blank"> <input type="checkbox" id="c1" name="attempt" value="101"> i'st attempt<br>
2nd attempt
then how should write code accessing posted value in c#asp ?
protected void page_load(object sender, eventargs e) { httpcontext context = httpcontext.current; namevaluecollection nvc = context.request.form; string username = nvc["c1"]; string password = nvc["c2"]; textbox1.text = username; textbox2.text = password; }
its not working properly
make runat server control
<input type="checkbox" runnat="server" id="c1" name="attempt" value="101">
then can refer directly c1 in codebehind
Comments
Post a Comment