This documentation is archived and is not being maintained.

TableRow.TableSection Property

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)

Not applicable.

Property Value

A TableRowSection value. The default is TableBody.

Exception typeCondition


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


The header row.


The body of the table.


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#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 

<html xmlns="" >
<head id="Head1" runat="server">
    <title>TableRow, TableFooter Example</title>
    <form id="form1" runat="server">

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


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