GridView.CaptionAlign 속성

정의

GridView 컨트롤에 있는 HTML 캡션 요소의 가로 또는 세로 위치를 가져오거나 설정합니다. 이 속성을 사용하면 보조 기술 디바이스 사용자가 컨트롤에 더 쉽게 액세스할 수 있습니다.

public:
 virtual property System::Web::UI::WebControls::TableCaptionAlign CaptionAlign { System::Web::UI::WebControls::TableCaptionAlign get(); void set(System::Web::UI::WebControls::TableCaptionAlign value); };
public virtual System.Web.UI.WebControls.TableCaptionAlign CaptionAlign { get; set; }
member this.CaptionAlign : System.Web.UI.WebControls.TableCaptionAlign with get, set
Public Overridable Property CaptionAlign As TableCaptionAlign

속성 값

TableCaptionAlign

TableCaptionAlign 값 중 하나입니다. 기본값은 브라우저의 기본 설정을 사용하는 TableCaptionAlign.NotSet입니다.

예외

지정한 값이 TableCaptionAlign 열거형 값이 아닌 경우

예제

다음 예제에서는 컨트롤의 CaptionAlign 캡션 요소가 컨트롤의 맨 위에 정렬되도록 지정하기 위해 GridView 속성을 사용하는 방법을 보여 줍니다.


<%@ 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 Caption and CaptionAlign Example</title>
</head>
<body>
    <form id="form1" runat="server">
        
      <h3>GridView Caption and CaptionAlign Example</h3>

      <asp:gridview id="CustomersGridView" 
        datasourceid="CustomersSource" 
        autogeneratecolumns="true"
        emptydatatext="No data available." 
        allowpaging="true"
        caption="Customer Information Table"
        captionalign="Top"   
        runat="server">                
      </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 Caption and CaptionAlign Example</title>
</head>
<body>
    <form id="form1" runat="server">
        
      <h3>GridView Caption and CaptionAlign Example</h3>

      <asp:gridview id="CustomersGridView" 
        datasourceid="CustomersSource" 
        autogeneratecolumns="true"
        emptydatatext="No data available." 
        allowpaging="true"
        caption="Customer Information Table"
        captionalign="Top"   
        runat="server">                
      </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>

설명

컨트롤에서 CaptionAlign HTML 캡션 요소 GridView 의 가로 또는 세로 위치를 지정하려면 이 속성을 사용합니다. 이 속성을 사용하면 보조 기술 디바이스 사용자가 컨트롤에 더 쉽게 액세스할 수 있습니다.

이 속성은 TableCaptionAlign 열거형의 값 중 하나로 설정됩니다. 다음 표에서 가능한 값을 나열합니다.

설명
TableCaptionAlign.Bottom 캡션 요소가 테이블의 아래쪽에 맞춰집니다.
TableCaptionAlign.Left 캡션 요소가 테이블의 왼쪽에 맞춰집니다.
TableCaptionAlign.NotSet 캡션 요소의 맞춤이 설정되지 않았습니다.
TableCaptionAlign.Right 캡션 요소가 테이블의 오른쪽에 맞춰집니다.
TableCaptionAlign.Top 캡션 요소가 테이블의 위쪽에 맞춰집니다.

참고

이 속성을 설정 TableCaptionAlign.NotSet하면 브라우저의 기본값이 사용됩니다.

HTML 캡션 요소의 텍스트를 지정하려면 속성을 사용합니다 Caption .

적용 대상

추가 정보