HtmlTableHeaderSection Class

[Note: This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Represents the thead element in an HtmlTable control.

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

public class HtmlTableHeaderSection : HtmlTableRow

Use the HtmlTableHeaderSection control to programmatically access the thead child element of a table element on the server.

The rows of the HtmlTableHeaderSection are stored in the Rows property of the control. This allows you to programmatically access the individual rows of the head element

The following example shows how to programmatically change the text of a header element in the HtmlTableHeaderSection of a table.

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

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

<script runat="server">
    protected void Button1_Click(object sender, EventArgs e)
        if (((Button)sender).Text == "Submit")
            // Set a property of the HtmlTableBodySection.
            TheBody.BgColor = "gray";
            // Add a new row to the HtmlTableBodyRowControlCollection.
            HtmlTableRow tr = new HtmlTableRow();
            HtmlTableCell tc = new HtmlTableCell();
            tc.InnerText = DateTime.Now.ToString();
            tc.ColSpan = 2;
            // Set the text of a Button control in the HtmlTableFooterSection.
            Button1.Text = "Clear";
            // Set the text of a column header.
            Column1Header.InnerText = "New Header";
            // Reset values.
            TheBody.BgColor = "white";
            Button1.Text = "Submit";
            Column1Header.InnerText = "Column1 Header";


<html xmlns="">
<head id="Head1" runat="server">
    <title>HtmlTable Sections</title>
    <form id="form1" runat="server">
    <table id="Table1" runat="server" style="border: solid 1px blue" >
 					<td id="Column1Header">Column1 Header</td>
					<td>Column2 Header</td>
			<tbody id="TheBody">
			<td id="BodyCell1">Table Cell 1.</td>
			<td id="BodyCell2">Table Cell 2.</td>
			<tfoot >
				<tr >
 					<td colspan="2" style="text-align:right" >
 					<asp:Button ID="Button1" runat="server" Text="Submit" 
 					            onclick="Button1_Click" />

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows Vista, Windows XP SP2, Windows Server 2003

The .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.5