This documentation is archived and is not being maintained.

GridView.FooterRow Property

Gets a GridViewRow object that represents the footer row in a GridView control.

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

<BrowsableAttribute(False)> _
Public Overridable ReadOnly Property FooterRow As GridViewRow
Dim instance As GridView 
Dim value As GridViewRow 

value = instance.FooterRow

Property Value

Type: System.Web.UI.WebControls.GridViewRow
A GridViewRow that represents the footer row in a GridView control.

Use the FooterRow property to programmatically access the GridViewRow object that represents the footer row in a GridView control.


The FooterRow property is available only after the GridView control creates the footer row in the RowCreated event.

This property is commonly used when you need to programmatically manipulate the footer row, for example when adding custom content. Any modification to the FooterRow property must be performed after the GridView control has been rendered; otherwise, the GridView control will overwrite any changes.

The following example demonstrates how to use the FooterRow property to display the sort direction in the footer row.

<%@ Page language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
<script runat="server">

  Sub CustomersGridView_DataBound(ByVal sender As Object, ByVal e As EventArgs)

    ' Get the header row. 
    Dim headerRow As GridViewRow = CustomersGridView.HeaderRow

    ' Get the footer row. 
    Dim footerRow As GridViewRow = CustomersGridView.FooterRow

    ' Set the font color of the header and footer rows 
    ' based on the sort direction.  
    Select Case CustomersGridView.SortDirection

      Case SortDirection.Ascending
        headerRow.ForeColor = System.Drawing.Color.Green
        footerRow.ForeColor = System.Drawing.Color.Green
      Case SortDirection.Descending
        headerRow.ForeColor = System.Drawing.Color.Red
        footerRow.ForeColor = System.Drawing.Color.Red
      Case Else
        headerRow.ForeColor = System.Drawing.Color.Black
        footerRow.ForeColor = System.Drawing.Color.Black

    End Select 

    ' Display the sort order in the footer row.
    footerRow.Cells(0).Text = "Sort Order = " & CustomersGridView.SortDirection.ToString()

  End Sub


<html xmlns="" >
  <head runat="server">
    <title>GridView HeaderRow and FooterRow Example</title>
    <form id="form1" runat="server">

      <h3>GridView HeaderRow and FooterRow Example</h3>

      <asp:gridview id="CustomersGridView" 
        emptydatatext="No data available." 

        <headerstyle backcolor="LightCyan"

        <footerstyle backcolor="LightCyan"


      <!-- This example uses Microsoft SQL Server and connects  -->
      <!-- to the Northwind sample database. Use an ASP.NET     -->
      <!-- expression to retrieve the connection string value   -->
      <!-- from the Web.config file.                            -->
      <asp:sqldatasource id="CustomersSource"
        selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]"
        connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" 


Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

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

.NET Framework

Supported in: 3.5, 3.0, 2.0