Export (0) Print
Expand All

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; }
<asp:TableRow TableSection="TableRowSection" />

Property Value

Type: System.Web.UI.WebControls.TableRowSection
A TableRowSection value. The default is TableBody.


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="http://www.w3.org/1999/xhtml" >
<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

Supported in: 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

© 2014 Microsoft