Export (0) Print
Expand All

TableFooterRow Class

Note: This class is new in the .NET Framework version 2.0.

Represents a footer row in a Table control.

Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)

public ref class TableFooterRow : public TableRow
public class TableFooterRow extends TableRow
public class TableFooterRow extends TableRow

The TableFooterRow class represents a footer row in a Table control. This class supports displaying tables on devices with a limited screen size. On these devices, a table with many columns and rows must be rendered across multiple pages. Adding a TableFooterRow to a Table control allows you to specify a footer row that is rendered as the last row on each page that displays a view of the table. For more information about the view formats for a table rendered on a device with a limited screen size, see Table.

A TableFooterRow object can contain only TableCell objects. To add content to the TableFooterRow, you must add one or more TableCell objects to the row. Then, set the Text property of each TableCell object in the row to specify the contents of each cell. Alternatively, you can add a control to a TableCell object to specify its contents.

You can programmatically manage the cells in the TableFooterRow by using the Cells collection. The Cells collection is a collection of TableCell objects that represent the cells in the row.

The TableFooterRow inherits properties from TableRow that allow you to control how the contents in the row are displayed. For example, you can use the HorizontalAlign and VerticalAlign properties to specify the alignment of the contents.

The following code example demonstrates the declarative syntax for creating a Table control that has a TableHeaderRow and a TableFooterRow.

<%@ Page Language="VB" %>

<html>
    <body>
        <form ID="Form1" runat="server">
        
            <h3>TableHeaderRow and TableFooterRow Example</h3>
              
            <asp:table id="Table1" runat="server" 
                CellPadding="3" 
                CellSpacing="3"
                runat="server">
                
                <asp:TableHeaderRow id=Table1HeaderRow 
                    runat="server">
                    <asp:TableCell Text="The header row."></asp:TableCell>
                </asp:TableHeaderRow>              
                 
                <asp:TableRow>
                    <asp:TableCell Text="(0,0)"></asp:TableCell>
                    <asp:TableCell Text="(0,1)"></asp:TableCell>
                    <asp:TableCell Text="(0,2)"></asp:TableCell>
                </asp:TableRow>
                
                <asp:TableRow>
                    <asp:TableCell Text="(1,0)"></asp:TableCell>
                    <asp:TableCell Text="(1,1)"></asp:TableCell>
                    <asp:TableCell Text="(1,2)"></asp:TableCell>
                </asp:TableRow> 
                
                <asp:TableFooterRow id="Table1FooterRow"
                    runat="server">
                    <asp:TableCell Text="The footer row."></asp:TableCell>
                </asp:TableFooterRow>                               
                                                   
            </asp:table>
                        
        </form>
    </body>
</html>

The following code example demonstrates how to programmatically create a Table control that has a TableHeaderRow and a TableFooterRow.

NoteNote

The following code sample uses the single-file code model and may not work correctly if copied directly into a code-behind file. This code sample must be copied into an empty text file that has an .aspx extension. For more information on the Web Forms code model, see ASP.NET Web Page Code Model.

<%@ Page Language="VB" %>

<html>
    <head>
        <script runat="server">
            Private Sub Page_Load(sender As Object, e As System.EventArgs)
                
                ' Add rows to the table.
                Dim i As Integer
                For i = 0 To 100
                    Dim tempRow As New TableRow
                    Dim j As Integer
                    For j = 0 To 2
                        Dim tempCell As New TableCell
                        tempCell.Text = "(" & i & "," & j & ")"
                        tempRow.Cells.Add(tempCell)
                    Next j
                    Table1.Rows.Add(tempRow)
                Next i
                
                ' Create a TableHeaderRow.
                Dim headerRow As New TableHeaderRow
                
                ' Create TableCell objects to contain the text for the header.
                Dim headerTableCell1 As New TableCell
                Dim headerTableCell2 As New TableCell
                Dim headerTableCell3 As New TableCell
                headerTableCell1.Text = "Column 1 header"
                headerTableCell2.Text = "Column 2 header"
                headerTableCell3.Text = "Column 3 header"
                
                ' Add the TableCell objects to the Cells
                ' collection of the TableHeaderRow.
                headerRow.Cells.Add(headerTableCell1)
                headerRow.Cells.Add(headerTableCell2)
                headerRow.Cells.Add(headerTableCell3)

                ' Add the TableHeaderRow as the first item 
                ' in the Rows collection of the table.
                Table1.Rows.AddAt(0, headerRow)
                
                ' Create a TableFooterRow.
                Dim footerRow As New TableFooterRow
                
                ' Create TableCell objects to contain the text for the footer.
                Dim footerTableCell1 As New TableCell
                Dim footerTableCell2 As New TableCell
                Dim footerTableCell3 As New TableCell
                footerTableCell1.Text = "Column 1 footer"
                footerTableCell2.Text = "Column 2 footer"
                footerTableCell3.Text = "Column 3 footer"

                ' Add the TableCell objects to the Cells
                ' collection of the TableFooterRow.
                footerRow.Cells.Add(footerTableCell1)
                footerRow.Cells.Add(footerTableCell2)
                footerRow.Cells.Add(footerTableCell3)

                ' Add the TableFooterRow to the Rows
                ' collection of the table.
                Table1.Rows.Add(footerRow)
                
            End Sub
        </script>
    </head>

    <body>
        <form ID="Form1" runat="server">
        
            <h3>TableHeaderRow and TableFooterRow Example</h3>
              
            <asp:table id="Table1"  
                CellPadding="3" 
                CellSpacing="3"
                Gridlines="Both"
                runat="server">                                                          
            </asp:table>
            
        </form>
    </body>
</html>

System.Object
   System.Web.UI.Control
     System.Web.UI.WebControls.WebControl
       System.Web.UI.WebControls.TableRow
        System.Web.UI.WebControls.TableFooterRow

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 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft