GridView.UseAccessibleHeader Właściwość

Definicja

Pobiera lub ustawia wartość wskazującą, czy kontrolka GridView renderuje nagłówek w dostępnym formacie. Ta właściwość jest udostępniana w celu zwiększenia dostępności kontroli dla użytkowników urządzeń z technologią pomocniczą.

public:
 virtual property bool UseAccessibleHeader { bool get(); void set(bool value); };
public virtual bool UseAccessibleHeader { get; set; }
member this.UseAccessibleHeader : bool with get, set
Public Overridable Property UseAccessibleHeader As Boolean

Wartość właściwości

true jeśli kontrolka GridView renderuje nagłówek w dostępnym formacie; w przeciwnym razie false. Wartość domyślna to true.

Przykłady

W poniższym przykładzie pokazano, jak za pomocą UseAccessibleHeader właściwości wyłączyć dostępny nagłówek.


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

<%@ Page language="VB" %>

<!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>

Uwagi

UseAccessibleHeader Użyj właściwości , aby określić, czy kontrolka GridView renderuje wiersz nagłówka w dostępnym formacie. Ta właściwość jest udostępniana w celu zwiększenia dostępności kontroli dla użytkowników urządzeń z technologią pomocniczą. Domyślnie wartość tej właściwości to true i nagłówek kontrolki jest renderowany przy użyciu <th> tagów komórek nagłówka tabeli. Ponadto atrybut jest dodawany do nagłówka tabeli w scope="col" celu określenia, że nagłówek ma zastosowanie do wszystkich komórek w kolumnie. Domyślne renderowanie elementu jest zachowywane, renderowanie <th> tekstu jako pogrubionego i wyśrodkowanego w poziomie. Deweloperzy mogą zastąpić styl <th> elementu przy użyciu kaskadowego arkusza stylów.

Jeśli wartość tej właściwości to false, nagłówek kontrolki jest renderowany przy użyciu <td> tagów komórek tabeli.

Dotyczy

Zobacz też