Export (0) Print
Expand All

HtmlTableRow.Height Property

Gets or sets the height (in pixels) of the row represented by an instance of the HtmlTableRow class.

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

public string Height { get; set; }
/** @property */
public String get_Height ()

/** @property */
public void set_Height (String value)

public function get Height () : String

public function set Height (value : String)

Not applicable.

Property Value

The height (in pixels) of the row represented by an instance of HtmlTableRow. The default value is String.Empty, which indicates that this property is not set.

Use the Height property to specify the height (in pixels) of the cell represented by an instance of the HtmlTableRow class. All cells in the row share the same height.


If you specify a height that is smaller than is required to display the contents of the cells in the row of a table, this property is ignored.

The following code example demonstrates how to use the Height property to control the height of a row in the HtmlTable control.

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<script runat="server">

  void Button_Click(Object sender, EventArgs e)

    // Iterate through the rows of the table.
    for (int i = 0; i <= Table1.Rows.Count - 1; i++)

      // Update the properties of each row. 
      Table1.Rows[i].BgColor = BgColorSelect.Value;
      Table1.Rows[i].BorderColor = BorderColorSelect.Value;
      Table1.Rows[i].Height = HeightSelect.Value;




<html xmlns="http://www.w3.org/1999/xhtml" >
   <title>HtmlTableRow Example</title>

   <form id="form1" runat="server">

      <h3>HtmlTableRow Example</h3>

      <table id="Table1" 
             style="border-width:1; border-color:Black"

               Cell 1.
               Cell 2.
               Cell 3.
               Cell 4.


      <hr />

      Select the display settings for the rows in the table: <br /><br />

      <select id="BgColorSelect" 

         <option value="Red">Red</option>
         <option value="Blue">Blue</option>
         <option value="Green">Green</option>
         <option value="Black">Black</option>
         <option value="White" selected="selected">White</option>


      <select id="BorderColorSelect" 

         <option value="Red">Red</option>
         <option value="Blue">Blue</option>
         <option value="Green">Green</option>
         <option value="Black" selected="selected">Black</option>
         <option value="White">White</option>


      <br /><br />

      <select id="HeightSelect" 

         <option value="0">0</option>
         <option value="100">100</option>
         <option value="150">150</option>
         <option value="200">200</option>
         <option value="250">250</option>

      <br /><br />
      <input type="button" 
             value="Generate Table"



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

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

© 2015 Microsoft