Introduction
Here I am going to discuss about TextBox's Textmode property enhancement. Text Box control's Textmode property support
HTML5 types . In ASP.NET 4.5 there are number of options with Textmode property,which are supported by different browers
Description
In previous versions of ASP.NET there were only
three properties for Textmode property of Asp.net textbox control.
- MultiLine- for multiline textbox.
- Password- for password textbox
- SignleLine –for single line textbox
With ASP.NET 4.5 there are
number of options with Textmode property,which are as follows:
- Color- This can be use for Color
entries
- Date- It is use for date
entries. You can enter dates only
- DateTime – It is use for datetime
entries with respect to local time zone.
- DateTimeLocal- It is use for datetime
entries with respect to local time zone.
- Email- It is use for email address
- Month- This can be use for month
and year entry.
- Number- It is use for
entering numeric values.
- Range- This can be use for
containing range between two numbers.
- Search- This can be use for search
field. A search field is like regular text fields
- Tel- It is use for telephone
number.
- Url- Used for entering website
url e. It will only contain urls.
- Week- for entering weeks and year.
Example
Select File > New
Project and in the New Project dialog select “ASP.NET Web Forms Application”
template
You can choose a TextBox
from the tool box and set the Textmode property as follows:
<asp:TextBox ID="phone" runat="server"
Textmode="Date"></asp:TextBox>
<asp:TextBox ID="phone" runat="server"
Textmode="Color"></asp:TextBox>
Same like this you can select any Textmode property as desired as use it for different purpose.

M LPosted Oct 19, 2023, 5:27 PM
I know this is an old post, how can I validate the difference between two textboxes set to time. I need to ensure the end time is after start time... I cannot find documentation on this feature. Also, the OnTextChange event with AutoPostBack set to true does not work well with this feature... or an I doing something wrong?
kyaw myoPosted Jul 30, 2014, 1:42 PM
textmode = date is not change design. i can see text box style. Visual Studio is 2012 version. i want to use date and time of textmode.
Rama KrishnaPosted May 5, 2014, 12:44 PM
when i am using email textmode property it is showing an error and the error is:'System.Web.UI.WebControls.TextBoxMode' does not contain a definition for 'Phone'.What should i do in this case?
Gokul DahalPosted Jun 6, 2013, 2:27 AM
very informative...
Pankaj PandeyPosted Apr 23, 2013, 1:16 AM
too good..
Seema ChaudharyPosted Apr 16, 2013, 3:23 AM
@rohtash kumar...thnks sir
Rohatash KumarPosted Apr 16, 2013, 2:25 AM
Nice blog to learning.