GridView.Caption 속성

정의

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

public:
 virtual property System::String ^ Caption { System::String ^ get(); void set(System::String ^ value); };
public virtual string Caption { get; set; }
member this.Caption : string with get, set
Public Overridable Property Caption As String

속성 값

String

GridView 컨트롤의 HTML 캡션 요소에서 렌더링할 텍스트를 나타내는 문자열입니다. 기본값은 빈 문자열("")입니다.

예제

다음 예제에서는 컨트롤에 대 한 캡션을 Caption 지정 하는 속성을 사용 하는 방법을 보여 줍니다 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>

설명

컨트롤의 Caption HTML 캡션 요소 GridView 에서 렌더링할 텍스트를 지정하려면 이 속성을 사용합니다. 지정 하는 텍스트 컨트롤을 보다 쉽게 액세스할 수 있도록 하는 데 사용할 수 있는 테이블에 대 한 설명 사용 하 여 보조 기술 디바이스를 제공 합니다. 속성을 사용하여 CaptionAlign HTML 캡션 요소를 렌더링할 위치를 지정할 수도 있습니다.

이 속성의 값으로 설정 된 경우 디자이너 도구를 사용 하 여 리소스 파일에 자동으로 저장 될 수 있습니다. 자세한 내용은 LocalizableAttribute 하 고 전역화 및 지역화합니다.

적용 대상

추가 정보