Riddhi Valecha

Riddhi Valecha

  • 444
  • 3.3k
  • 412.8k

Access html control value from code-behind

Jan 7 2016 7:18 AM
Hi all...
 
I have HTML Controls as -
 
<div class="cont-input fl"><input name="" type="text" value="Name" onBlur="if(this.value=='') this.value='Name';" onFocus="if(this.value=='Name') this.value='';" id="txtName" runat="server" ></div>
 
Issue - When I type a name say "Mahesh Sharma" , then I want to access the value "Mahesh Sharma" in code-behind (aspx.cs file).
 
When I type - txtName.Value - I get "Name" as Value.
 
How to access the user-entered value from backend ?

Answers (3)