GridView.UseAccessibleHeader プロパティ

定義

GridView コントロールのヘッダーをユーザー補助対応の形式で表示するかどうかを示す値を取得します。 このプロパティは、補助技術デバイスのユーザーにとって、より使いやすいコントロールを実現するための手段として用意されています。

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

プロパティ値

GridView コントロールのヘッダーをユーザー補助対応の形式で表示する場合は true。それ以外の場合は false。 既定値は、true です。

次の例では、 プロパティを使用 UseAccessibleHeader してアクセス可能なヘッダーを無効にする方法を示します。


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

注釈

プロパティを UseAccessibleHeader 使用して、コントロールがヘッダー行を GridView アクセシビリティ対応の形式でレンダリングするかどうかを指定します。 このプロパティは、補助技術デバイスのユーザーにとって、より使いやすいコントロールを実現するための手段として用意されています。 既定では、このプロパティの値は であり true 、コントロールのヘッダーはテーブル ヘッダー セル タグを使用して <th> レンダリングされます。 さらに、 scope="col" 列内のすべてのセルにヘッダーが適用されることを指定するために、属性がテーブル ヘッダーに追加されます。 要素の既定の <th> レンダリングは保持され、テキストは太字で水平方向に中央揃えで表示されます。 開発者は、カスケード スタイル シートを <th> 使用して要素のスタイルをオーバーライドできます。

このプロパティの値が の場合、 falseコントロールのヘッダーはテーブル セル タグを使用して <td> レンダリングされます。

適用対象

こちらもご覧ください