This documentation is archived and is not being maintained.

HtmlTableCell.RowSpan Property

Gets or sets the number of rows occupied by a cell represented by an instance of the HtmlTableCell class.

[Visual Basic]
Public Property RowSpan As Integer
[C#]
public int RowSpan {get; set;}
[C++]
public: __property int get_RowSpan();
public: __property void set_RowSpan(int);
[JScript]
public function get RowSpan() : int;
public function set RowSpan(int);

Property Value

The number of rows occupied by a cell represented by an instance of the HtmlTableCell class. The default value is -1, which indicates that this property is not set.

Remarks

In a cell represented by an instance of the HtmlTableCell class, use the RowSpan property to specify the number of rows the cell occupies. This allows you to create a cell in the table that occupies more than one row. For example, suppose you have a table that contains two columns and two rows. You can create a column that overlaps both rows. Set the RowSpan property of the left-most cell in the first column to 2 to indicate that this cell takes up two rows in the table.

CAUTION   When spanning rows, be sure to define one less cell in the column for each row that you span. For example, if you span two rows, define one less cell in that column. Otherwise, that column will be longer than the number of rows in the table and the table will not be displayed as expected.

Example

[Visual Basic, C#] The following example demonstrates how to use the RowSpan property to specify that the cell in the first column of the HtmlTable control spans two rows.

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

<html>
<head>

</head>
<body>

   <form runat="server">

      <h3>HtmlTableCell Example</h3>

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

         <tr>
            <td RowSpan="2">
               Cell 1.
            </td>
            <td>
               Cell 2.
            </td>
         </tr>
         <tr>
            <td>
               Cell 4.
            </td>
         </tr>

      </table>      

   </form>

</body>
</html>

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

<html>
<head>

</head>
<body>

   <form runat="server">

      <h3>HtmlTableCell Example</h3>

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

         <tr>
            <td RowSpan="2">
               Cell 1.
            </td>
            <td>
               Cell 2.
            </td>
         </tr>
         <tr>
            <td>
               Cell 4.
            </td>
         </tr>

      </table>      

   </form>

</body>
</html>

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# 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

HtmlTableCell Class | HtmlTableCell Members | System.Web.UI.HtmlControls Namespace | Align | ColSpan | NoWrap | VAlign

Show: