HtmlTextArea.Rows Property

Gets or sets the height (in characters) of the HtmlTextArea control.

Namespace: System.Web.UI.HtmlControls
Assembly: System.Web (in system.web.dll)

public int Rows { get; set; }
/** @property */
public int get_Rows ()

/** @property */
public void set_Rows (int value)

public function get Rows () : int

public function set Rows (value : int)

Property Value

The height (in characters) of the HtmlTextArea control. The default value is -1, which indicates that this property is not set.

Use the Rows property to specify or determine the height (in characters) of the HtmlTextArea control. If you enter text that takes up more lines than the height specified, scroll bars are enabled.

To control the width of the control, set the Cols property.

The following code example demonstrates how to use the Rows property to control the height of the HtmlTextArea control.

<%@ Page Language="C#" AutoEventWireup="True" %>

<script runat="server">

  void SubmitBtn_Click(Object sender, EventArgs e)
    TextArea1.Rows = Convert.ToInt32(Select1.Value);
    Span1.InnerHtml = "You wrote: <br>" + TextArea1.Value;


   <title>HtmlTextArea Example</title>

   <form runat="server">

      <h3>HtmlTextArea Example</h3>

      Enter your comments: <br>

      <textarea id="TextArea1" 


      Select row height: <br>

      <select id="Select1" 

         <option value="1" selected> 1 </option>
         <option value="2"> 2 </option>
         <option value="3"> 3 </option>
         <option value="4"> 4 </option>
         <option value="5"> 5 </option>
         <option value="6"> 6 </option>



      <input type="submit"  


      <span id="Span1" 
            runat="server" />



Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0