TableRow.TableSection Property

Note: This property is new in the .NET Framework version 2.0.

Gets or sets the location for a TableRow object in a Table control.

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

public virtual TableRowSection TableSection { get; set; }
/** @property */
public TableRowSection get_TableSection ()

/** @property */
public void set_TableSection (TableRowSection value)

public function get TableSection () : TableRowSection

public function set TableSection (value : TableRowSection)

Property Value

A TableRowSection value. The default is TableBody.

Exception typeCondition

ArgumentOutOfRangeException

The TableRowSection is not valid.

Use the TableSection property to get or set where the TableRow object is placed in a Table control. For the available table locations, see TableRowSection. The following table lists the possible values.

Table row section

Displayed as

TableHeader

The header row.

TableBody

The body of the table.

TableFooter

The footer row.

When using the declarative syntax, the sections must be in the order of header, body, and then footer.

The TableRowSection enumeration enables you to build accessible Web sites using the Table control by adding the <thead>, <tbody>, and <tfoot> elements to the HTML that is rendered to the client. If all rows in a table are in the <tbody> element, the section information is not rendered. At least one row must be in a non-body element.

The value of this property is stored in view state.

The following code example demonstrates how to use the TableSection property to define header and footer rows in a Table control.

<%@ Page language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="System.Drawing" %>

<html>
    <head>
        <script runat="server">
        </script>
    </head>

    <body>
        <form runat="server">
            <h1>TableRow.TableFooter Example</h1>
            <asp:table id="Table1" runat="server" CellPadding="3" CellSpacing="3">
                <asp:TableRow TableSection=TableHeader BackColor=pink>
                    <asp:TableCell Text="Header"></asp:TableCell>
                </asp:TableRow>
                <asp:TableRow>
                    <asp:TableCell Text="(1,0)"></asp:TableCell>
                    <asp:TableCell Text="(1,1)"></asp:TableCell>
                    <asp:TableCell Text="(1,2)"></asp:TableCell>
                </asp:TableRow>
                <asp:TableRow TableSection=TableFooter BackColor=pink>
                    <asp:TableCell Text="Footer"></asp:TableCell>
                </asp:TableRow>
            </asp:table>
        </form>
    </body>
</html>

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

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

.NET Framework

Supported in: 2.0
Show: