Wednesday, February 20, 2013

Text Mode in ASP.NET TextBox


There are 3 text modes in a ASP.NET text box. Below are some simple demonstrations on each of those modes.

SingleLine - This is the default mode and displays the single line input line as shown below.




<asp:TextBox ID="TextBox1" runat="server" >
</asp:TextBox>


Rendered to the browser as:

<input name="TextBox1" type="text" id="TextBox1" />


MultiLine - Display a multiline input field as shown below.



<asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine" >
</asp:TextBox>


Rendered to the browser as:

<textarea name="TextBox1" rows="2" cols="20" id="TextBox1"></textarea>


Password - Single line input field with masked text.



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


Rendered to the browser as:

<input name="TextBox1" type="password" id="TextBox1" />

No comments:
Write comments
Recommended Posts × +