Click here to Skip to main content
15,891,253 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
How to get values from html input controls using c# ?
Posted

var name = this.Request.Form["txtName"];
 
Share this answer
 
Hi, if you want to get value of html control on form submit without making it runat="server" then do somthing like this
C#
string name = String.Format("{0}", Request.Form['TextBox1']);
 
Share this answer
 
try following code:

HTML :
<input type="text" runat="server" id="txtInput" />

C# code behind :
string sValu = txtInput.Value.ToString();
 
Share this answer
 
Hi,

Attach runat="server" attribute to your HTML control t access the same using C#.

-SP
 
Share this answer
 
 
Share this answer
 
HTML Code Like



]]>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900