Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
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.

[Visual Basic]
Public Property Height As String
[C#]
public string Height {get; set;}
[C++]
public: __property String* get_Height();
public: __property void set_Height(String*);
[JScript]
public function get Height() : String;
public function set Height(String);

Property Value

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

Remarks

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.

Note   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.

Example

[Visual Basic, C#, JScript] The following example demonstrates how to use the Height property to control the height of a row in the HtmlTable control.

[Visual Basic] 
<%@ Page Language="VB" AutoEventWireup="True" %>

<html>
<head>

   <script runat="server">

      Sub Button_Click(sender As Object, e As EventArgs) 

         Dim i As Integer

         ' Iterate through the rows of the table.
         For i=0 To Table1.Rows.Count - 1

            ' Update the properties of each row. 
            Table1.Rows(i).BgColor = BgColorSelect.Value 
            Table1.Rows(i).BorderColor = BorderColorSelect.Value
            Table1.Rows(i).Height = HeightSelect.Value 

         Next i

      End Sub

   </script>

</head>
<body>

   <form runat="server">

      <h3>HtmlTableRow Example</h3>

      <table id="Table1" 
             Border="1" 
             BorderColor="black" 
             runat="server">

         <tr>
            <td>
               Cell 1.
            </td>
            <td>
               Cell 2.
            </td>
         </tr>
         <tr>
            <td>
               Cell 3.
            </td>
            <td>
               Cell 4.
            </td>
         </tr>

      </table>

      <hr>

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

      BgColor:
      <select id="BgColorSelect" 
              runat="server">

         <option Value="Red">Red</option>
         <option Value="Blue">Blue</option>
         <option Value="Green">Green</option>
         <option Value="Black">Black</option>
         <option Value="White" Selected="True">White</option>
        
      </select>

      &nbsp;&nbsp;

      BorderColor:
      <select id="BorderColorSelect" 
              runat="server">

         <option Value="Red">Red</option>
         <option Value="Blue">Blue</option>
         <option Value="Green">Green</option>
         <option Value="Black" Selected="True">Black</option>
         <option Value="White">White</option>

      </select>

      <br><br>

      Height:
      <select id="HeightSelect" 
              runat="server">

         <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>

      </select>
       
      <br><br>
  
      <input type="button" 
             value="Generate Table"
             OnServerClick = "Button_Click" 
             runat="server"/>

   </form>

</body>
</html>

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

<html>
<head>

   <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; 

         }

      }

   </script>

</head>
<body>

   <form runat="server">

      <h3>HtmlTableRow Example</h3>

      <table id="Table1" 
             Border="1" 
             BorderColor="black" 
             runat="server">

         <tr>
            <td>
               Cell 1.
            </td>
            <td>
               Cell 2.
            </td>
         </tr>
         <tr>
            <td>
               Cell 3.
            </td>
            <td>
               Cell 4.
            </td>
         </tr>

      </table>

      <hr>

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

      BgColor:
      <select id="BgColorSelect" 
              runat="server">

         <option Value="Red">Red</option>
         <option Value="Blue">Blue</option>
         <option Value="Green">Green</option>
         <option Value="Black">Black</option>
         <option Value="White" Selected="True">White</option>
        
      </select>

      &nbsp;&nbsp;

      BorderColor:
      <select id="BorderColorSelect" 
              runat="server">

         <option Value="Red">Red</option>
         <option Value="Blue">Blue</option>
         <option Value="Green">Green</option>
         <option Value="Black" Selected="True">Black</option>
         <option Value="White">White</option>

      </select>

      <br><br>

      Height:
      <select id="HeightSelect" 
              runat="server">

         <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>

      </select>
       
      <br><br>
  
      <input type="button" 
             value="Generate Table"
             OnServerClick = "Button_Click" 
             runat="server"/>

   </form>

</body>
</html>

[JScript] 
<%@ Page Language="JScript" AutoEventWireup="True" %>

<html>
<head>

   <script runat="server">

      function Button_Click(sender, e : EventArgs) 
      {

         // Iterate through the rows of the table.
         for (var i : int=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; 

         }

      }

   </script>

</head>
<body>

   <form runat="server">

      <h3>HtmlTableRow Example</h3>

      <table id="Table1" 
             Border="1" 
             BorderColor="black" 
             runat="server">

         <tr>
            <td>
               Cell 1.
            </td>
            <td>
               Cell 2.
            </td>
         </tr>
         <tr>
            <td>
               Cell 3.
            </td>
            <td>
               Cell 4.
            </td>
         </tr>

      </table>

      <hr>

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

      BgColor:
      <select id="BgColorSelect" 
              runat="server">

         <option Value="Red">Red</option>
         <option Value="Blue">Blue</option>
         <option Value="Green">Green</option>
         <option Value="Black">Black</option>
         <option Value="White" Selected="True">White</option>
        
      </select>

      &nbsp;&nbsp;

      BorderColor:
      <select id="BorderColorSelect" 
              runat="server">

         <option Value="Red">Red</option>
         <option Value="Blue">Blue</option>
         <option Value="Green">Green</option>
         <option Value="Black" Selected="True">Black</option>
         <option Value="White">White</option>

      </select>

      <br><br>

      Height:
      <select id="HeightSelect" 
              runat="server">

         <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>

      </select>
       
      <br><br>
  
      <input type="button" 
             value="Generate Table"
             OnServerClick = "Button_Click" 
             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 Language Filter 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

HtmlTableRow Class | HtmlTableRow Members | System.Web.UI.HtmlControls Namespace | BgColor | BorderColor | Height | Align | VAlign

Show:
© 2015 Microsoft