Capturing text with MultiLine mode

Capturing text with MultiLine mode

In ASP.NET, the TextBox control is used to create an input field for capturing text input from users. By default, the TextBox control renders as a single-line input field, which is suitable for short text input. However, if you want to allow users to input longer text, you can use the TextMode property to change the rendering of the TextBox control to a multi-line text area.

To capture text input with the TextBox control in multi-line mode, follow these steps:

Drag and drop a TextBox control from the Toolbox onto your web page.

Set the TextMode property of the TextBox control to “MultiLine”.

Optionally, set the Rows and Columns properties of the TextBox control to adjust the size of the text area.

Use the Text property of the TextBox control to retrieve the text input from the user.

Here’s an example of how to create a TextBox control in multi-line mode:

<asp:TextBox ID=”txtInput” runat=”server” TextMode=”MultiLine” Rows=”5″ Columns=”50″></asp:TextBox>

In the code-behind file, you can retrieve the text input from the TextBox control using the Text property:

string userInput = txtInput.Text;

Apply for ASP.NET Certification Now!!

https://www.vskills.in/certification/certified-aspnet-programmer

Back to Tutorial

Accepting Passwords -Somewhat Securely
Finger mapping

Get industry recognized certification – Contact us

keyboard_arrow_up
Open chat
Need help?
Hello 👋
Can we help you?