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 –

<div>

<h5>Color:</h5>

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

<h5>Date:</h5>

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

<h5>Datetime:</h5>

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

<h5>Month:</h5>

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

<h5>Range:</h5>

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

<h5>Email:</h5>

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

</div>

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s