Learning Resources
 

Capturing text with MultiLine mode


The TextBox server control is an input control that lets the user enter text. By default, the TextMode property is set to SingleLine, which creates a text box with only one line. You can also set the property to MultiLine or Password. MultiLine creates a text box with more than one line. Password creates a single-line text box that masks the value entered by the user.

The display width of the text box is determined by its Columns property. If the text box is a multiline text box, the display height is determined by the Rows property.

An example of multiline textbox is given as -

<%@ Page Language="c#" %>
"server">

    void Page_Load()
    {
      if (Page.IsPostBack)
      {
          lblName.Text = "";
          lblAddress.Text = "";
          lblPassword.Text = "";
      }
    
      if (txtName.Text !="")
        lblName.Text = "You have entered the following name: " +  txtName.Text;
    
    
      if (txtAddress.Text !="")
        lblAddress.Text = "You have entered the following address: " + txtAddress.Text;
    
    
      if (txtPassword.Text !="")
        lblPassword.Text = "You have entered the following password: " + txtPassword.Text;
    
    
    }


<html>

    Text Box Example

<body>
    "lblName" runat="server">
    
    "lblAddress" runat="server">
    
    "lblPassword" runat="server">
    
    <form runat="server">
        Please enter your name: 
        "txtName" runat="server">
        
        
        Please enter your address: 
        "txtAddress" runat="server" textmode="multiline" rows="5">
        
        
        Please enter your password: 
        "txtPassword" runat="server" textmode="password">
        
        
        "submit" value="Submit Query" />
    form>
body>
html>

<%@ Page Language="c#" %>
"server">

    void Page_Load()
    {
      if (Page.IsPostBack)
      {
          lblName.Text = "";
          lblAddress.Text = "";
          lblPassword.Text = "";
      }
    
      if (txtName.Text !="")
        lblName.Text = "You have entered the following name: " +  txtName.Text;
    
    
      if (txtAddress.Text !="")
        lblAddress.Text = "You have entered the following address: " + txtAddress.Text;
    
    
      if (txtPassword.Text !="")
        lblPassword.Text = "You have entered the following password: " + txtPassword.Text;
    
    
    }


<html>

    Text Box Example

<body>
    "lblName" runat="server">
    
    "lblAddress" runat="server">
    
    "lblPassword" runat="server">
    
    <form runat="server">
        Please enter your name: 
        "txtName" runat="server">
        
        
        Please enter your address: 
        "txtAddress" runat="server" textmode="multiline" rows="5">
        
        
        Please enter your password: 
        "txtPassword" runat="server" textmode="password">
        
        
        "submit" value="Submit Query" />
    form>
body>
html>