Export (0) Print
Expand All

HtmlTableCell.RowSpan Property

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

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

public int RowSpan { get; set; }
/** @property */
public int get_RowSpan ()

/** @property */
public void set_RowSpan (int value)

public function get RowSpan () : int

public function set RowSpan (value : int)

Not applicable.

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.

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 leftmost cell in the first column to 2 to indicate that this cell takes up two rows in the table.

Caution noteCaution:

When spanning rows, be sure to define one fewer cell in the column for each row that you span. For example, if you span two rows, define one fewer 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.

The following code example demonstrates how to use the RowSpan property to specify that the cell in the first column of the HtmlTable control spans two rows.

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
   <title>HtmlTableCell Example</title>
</head>
<body>

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

      <h3>HtmlTableCell Example</h3>

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

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

      </table>      

   </form>

</body>
</html>

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

ADD
Show:
© 2014 Microsoft