HtmlTextArea.Rows Property
Gets or sets the height (in characters) of the HtmlTextArea control.
[Visual Basic] Public Property Rows As Integer [C#] public int Rows {get; set;} [C++] public: __property int get_Rows(); public: __property void set_Rows(int); [JScript] public function get Rows() : int; public function set Rows(int);
Property Value
The height (in characters) of the HtmlTextArea control. The default value is -1, which indicates that this property is not set.
Remarks
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.
Example
[Visual Basic, C#, JScript] The following example demonstrates how to use the Rows property to control the height of the HtmlTextArea control.
[Visual Basic] <%@ Page Language="VB" AutoEventWireup="True" %> <html> <head> <script runat="server"> Sub SubmitBtn_Click(sender As Object, e As EventArgs) TextArea1.Rows = CInt(Select1.Value) Span1.InnerHtml = "You wrote: <br>" + TextArea1.Value End Sub </script> </head> <body> <form runat=server> <h3>HtmlTextArea Example</h3> Enter your comments: <br> <textarea id="TextArea1" runat="server"/> <br> Select row height: <br> <select id="Select1" Multiple="False" runat="server"> <option value="1" Selected="True"> 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> </select> <br><br> <input type="submit" value="Submit" OnServerClick="SubmitBtn_Click" runat="server"/> <p> <span id="Span1" runat="server" /> </form> </body> </html> [C#] <%@ Page Language="C#" AutoEventWireup="True" %> <html> <head> <script runat="server"> void SubmitBtn_Click(Object sender, EventArgs e) { TextArea1.Rows = Convert.ToInt32(Select1.Value); Span1.InnerHtml = "You wrote: <br>" + TextArea1.Value; } </script> </head> <body> <form runat=server> <h3>HtmlTextArea Example</h3> Enter your comments: <br> <textarea id="TextArea1" runat="server"/> <br> Select row height: <br> <select id="Select1" Multiple="False" runat="server"> <option value="1" Selected="True"> 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> </select> <br><br> <input type="submit" value="Submit" OnServerClick="SubmitBtn_Click" runat="server"/> <p> <span id="Span1" runat="server" /> </form> </body> </html> [JScript] <%@ Page Language="JScript" AutoEventWireup="True" %> <html> <head> <script runat="server"> function SubmitBtn_Click(sender, e : EventArgs) { TextArea1.Rows = Convert.ToInt32(Select1.Value); Span1.InnerHtml = "You wrote: <br>" + TextArea1.Value; } </script> </head> <body> <form runat=server> <h3>HtmlTextArea Example</h3> Enter your comments: <br> <textarea id="TextArea1" runat="server"/> <br> Select row height: <br> <select id="Select1" Multiple="False" runat="server"> <option value="1" Selected="True"> 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> </select> <br><br> <input type="submit" value="Submit" OnServerClick="SubmitBtn_Click" runat="server"/> <p> <span id="Span1" runat="server" /> </form> </body> </html>
[C++] No example is available for C++. To view a Visual Basic, C#, or JScript example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
See Also
HtmlTextArea Class | HtmlTextArea Members | System.Web.UI.HtmlControls Namespace | Rows