Maxi
Maxi

Reputation: 109

aspx page using Input type Email

I have a textbox in a WebForm aspx page

<input ID="txtEmail" name="txtEmail" style="Font-Size:20px"  placeholder="Email" Type="Email" runat="server" />

But it keeps giving me error that 'Email' is not a valid type for an input tag. Weird enough it shows the option Email when I enter the word in the input tag Type= It shows Email as an option but then again says No such thing as email I need to use this to see if the entered email is ending with @Email.com

Upvotes: 1

Views: 382

Answers (2)

Simple Code
Simple Code

Reputation: 568

Try this: txtemail.Attributes.Add("type", "email");

If you try to use that like txtEmail.Attributes("type") = "email" Like @Scath mentioned it will not work because It's a property, not a method

Upvotes: 0

Emiliano Montesdeoca
Emiliano Montesdeoca

Reputation: 364

<asp:TextBox runat="server" type="email" id="emailtextbox" />

This works for me.

If it doesn't for you, you can add the attribute by hand like this:

emailtextbox.Attributes["type"] = "email"; 

Upvotes: 1

Related Questions