Export (0) Print
Expand All

GridView.UseAccessibleHeader Property

Gets or sets a value indicating whether a GridView control renders its header in an accessible format. This property is provided to make the control more accessible to users of assistive technology devices.

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

public virtual bool UseAccessibleHeader { get; set; }
/** @property */
public boolean get_UseAccessibleHeader ()

/** @property */
public void set_UseAccessibleHeader (boolean value)

public function get UseAccessibleHeader () : boolean

public function set UseAccessibleHeader (value : boolean)

Not applicable.

Property Value

true if the GridView control renders its header in an accessible format; otherwise, false. The default is true.

Use the UseAccessibleHeader property to specify whether the GridView control renders its header row in an accessible format. This property is provided to make the control more accessible to users of assistive technology devices. By default, the value of this property is true and the header for the control is rendered using <th> table header cell tags. In addition, a scope="col" attribute is added to the table header to specify that the header applies to all the cells in the column. The default rendering of the <th> element is preserved, rendering text as bold and centered horizontally. Developers can override the style of the <th> element using a cascading style sheet.

NoteNote:

Requiring the use of style sheets is discouraged when creating accessible Web pages.

If the value of this property is false, the header for the control is rendered using <td> table cell tags.

The following code example demonstrates how to use the UseAccessibleHeader property to disable the accessible header.


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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>GridView UseAccessibleHeader Example</title>
</head>
<body>
    <form id="form1" runat="server">
        
      <h3>GridView UseAccessibleHeader Example</h3>

      <asp:gridview id="CustomersGridView" 
        datasourceid="CustomersSource" 
        autogeneratecolumns="true"
        emptydatatext="No data available." 
        allowpaging="true"
        useaccessibleheader="false" 
        runat="server">
        
        <headerstyle backcolor="LightSteelBlue"
          font-names="Verdana"
          font-italic="true"
          font-size="12" 
          forecolor="Blue"/>
                        
      </asp:gridview>
            
      <!-- 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%>" 
        runat="server"/>
        
    </form>
  </body>
</html>


Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show:
© 2014 Microsoft