TextMode property in TextBox now supports new HTML5 controls

ASP.NET 4.5 has great support for HTML5. Starting with ASP.NET 4.5, TextMode property of TextBox control supports new HTML5 input types like email, datetime, and so on.

Following code snippet shows how to use some of these TextMode properties –

Most of the modern browsers have better support for these HTML 5 controls. Below is how Chrome displays some of these HTML 5 controls –

ASP.NET converts the TextMode property appropriately to type property of input tag –



<input name=”TextBox1″ type=”color” id=”TextBox1″ /><br/>


<input name=”TextBox2″ type=”date” id=”TextBox2″ /><br/>


<input name=”TextBox3″ type=”datetime” id=”TextBox3″ /><br/>


<input name=”TextBox4″ type=”month” id=”TextBox4″ /><br/>


<input name=”TextBox5″ type=”range” id=”TextBox5″ /><br/>


<input name=”TextBox6″ type=”email” id=”TextBox6″ /><br/>



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s