Height Property
Collapse the table of content
Expand the table of content

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; }
<asp:HtmlTableRow Height="String" />

Property Value

Type: System.String
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 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

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

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

Community Additions

© 2016 Microsoft