Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I force ASP:TextBox to be of type email?

I have an ASP.NET 3.5 application and I'd like to add the type="email" according to HTML5 standards but if I add the type on the ASP:TextBox control I get the below output:

<input name="ctl00$content$txtEmailAddress" type="text" type="email" value="" 
id="ctl00_content_txtEmailAddress" class="input-block-level" required="required"/>

How can I replace the type attribute from "text" to "email"?

like image 635
RealSollyM Avatar asked Jun 04 '13 09:06

RealSollyM


1 Answers

If you using .Net 3.5 then no matter what type you have specified with <asp:TextBox>, it will always render with <input type="text" />. So in that case you can use simple html input with type="email"

<input type="email" />

For 4.5 version you can use TextMode="Email"

<asp:TextBox ID="txtmyBox" runat="server" TextMode="Email"></asp:TextBox>
like image 109
Sachin Avatar answered Oct 20 '22 17:10

Sachin