GridView.FooterRow Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

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)

Public Overridable ReadOnly Property FooterRow As GridViewRow

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%>" 


.NET Framework
Available since 2.0
Return to top