Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

HtmlTableFooterSection Class

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

Represents the tfoot element in an HtmlTable control.

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

public class HtmlTableFooterSection : HtmlTableRow

Use the HtmlTableFooterSection control to programmatically control the tfoot child element of a table element on the server.

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

The following example shows how to programmatically access a Button control in the HtmlTableFooterSection of a table.

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<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;
            tr.Cells.Add(tc);
            TheBody.Rows.Add(tr);
            // Set the text of a Button control in the HtmlTableFooterSection.
            Button1.Text = "Clear";
            // Set the text of a column header.
            Column1Header.InnerText = "New Header";
        }
        else
        {
            // Reset values.
            TheBody.BgColor = "white";
            Button1.Text = "Submit";
            Column1Header.InnerText = "Column1 Header";
        }

    }
</script>

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


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
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.