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 Value

Type: System.Web.UI.WebControls.TableRowSection

A TableRowSection value. The default is TableBody.

Exception Condition

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


.NET Framework
Available since 2.0
Return to top