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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -