James123
James123

Reputation: 11652

input type="email" set value in asp.net code behind

How can I assign value to

<input type="email" class="form-control" placeholder="User name" required="" autofocus="" name="txtEmailId" id="txtEmailId" /> 

in the code behind?

Upvotes: 0

Views: 4229

Answers (1)

Sachin
Sachin

Reputation: 40970

Use runat="server" with markup

<input type="email" runat="server" class="form-control" placeholder="User name" required="" autofocus="" name="txtEmailId" id="txtEmailId" /> 

Now on code behind you can access it via txtEmailId

As Html 5 control is not available using runat attribute. You can directly use the TextBox like this

<asp:TextBox ID="txtEmailId" runat="server" TextMode="Email"></asp:TextBox>

Upvotes: 2

Related Questions