How to Change TextBox Control TextMode SingleLine, Password and MultiLine

change TextBox TextMode SingleLine, Password and MultiLine 

– Hi, Here we lean in this post, How to Change TextBox Control Mode, SingleLine Mode, MultiLine Mode, Password Mode in ASP,.Net C#.

– First we have to Design the ASP.Net Page with One TextBox along with Theree(3) Button  Control. The ASP.Net TextBox SingleLine Mode, MultiLine Mode and Password Mode Design Code is below :

write below code in head tag:-

<body></span>
<form id=”form1″ runat=”server”>
<table style=”width: 376px”>
<tr>
<td style=”width: 100px; text-align: right”>
TextBox :</td>
<td colspan=”2″ style=”text-align: left”>
<asp:TextBox ID=”TextBox1″ runat=”server”></asp:TextBox></td>
</tr>
<tr>
<td colspan=”3″ style=”height: 26px”>
&nbsp;<asp:Button ID=”Button1″ runat=”server” OnClick=”Button1_Click” Text=”SingleMode” />
<asp:Button ID=”Button2″ runat=”server” OnClick=”Button2_Click” Text=”PasswordMode”
Width=”112px” />
<asp:Button ID=”Button3″ runat=”server” OnClick=”Button3_Click” Text=”MultiLine”
Width=”112px” /></td>
</tr>
</table></form>
</body>

write below code for SingleLine TextBox:-

– SingleLine Mode means Default TextBox Control in ASP.Net simple allow to write in single line.
protected void Button1_Click(object sender, EventArgs e)
{
TextBox1.TextMode = TextBoxMode.SingleLine;
}

TextBox SingleTextMode in ASP.Net
TextBox SingleTextMode in ASP.Net

write below code for Password Mode TextBox:-

– Password Mode means Character show as a password charactre like small balck dots in TextBox Control in ASP.Net.

protected void Button2_Click(object sender, EventArgs e)
{
TextBox1.TextMode = TextBoxMode.Password;
}

TextBoxMode Password in ASP.Net
TextBoxMode Password in ASP.Net

write below code for MultiLineMode TextBox:-

– MultiLine Mode means TextBox control allow user to write in more then one line in ASP.Net.

protected void Button3_Click(object sender, EventArgs e)
{
TextBox1.TextMode = TextBoxMode.MultiLine;
}

MultiLine TextBoxMode in ASP.Net
MultiLine TextBoxMode in ASP.Net

The same things we can do without Programmatically like this:
Just SET the TextBox TextMode Property TextMode = SingleLine / MultiLine / Password for Change the TextBox TextMode.

– In above ASP.Net Tutorials, we have learn  How to change Textbox control TextMode in ASP.NEet C#.

– I hope, you will enjoy this  ASP.Net TextBox Example of  Change TextMode of TextBox Control.

Leave a Reply

Your email address will not be published. Required fields are marked *