TextBoxMode Enumeration or TextMode attribute of TextBox

| Thursday, February 20, 2014
The TextBoxMode enum specifies the behavior mode of the ASP.NET web control textbox. This is specified in the TextMode attribute of TextBox control.

 <asp:TextBox ID="txtPassword" runat="server" TextMode="Password"></asp:TextBox>  

"TextMode" attribute or "TextBoxMode" enum represents the different display options of the TextBox.

  • SingleLine - displays the textbox in a single row. If text exceeds the physical size of the control, it automatically adds scroll to the textbox
  • MultiLine - displays the height and length of the textbox based upon the Rows and Columns of the textbox. It allows text entry in multiple lines. Data entered in multiline textbox can be wrapped if Wrap property is set to true.
  • Password - similar to SingleLine except the all characters entered in Textbox are masked and not saved in viewstate.
There are other options also for TextMode attribute of textbox control like Email, Number, Date, DateTime etc. but they correspond to the type attribute of input element in the HTML5 hence not supported in other versions of html.


Post a Comment

Next Prev