다음을 통해 공유


DetailsView.Caption 속성

정의

DetailsView 컨트롤의 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

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

예제

다음 코드 예제에서는 컨트롤에서 Caption 렌더링 된 HTML 캡션 요소에 대 한 텍스트를 지정 하는 속성을 사용 하는 DetailsView 방법을 보여 줍니다.


<%@ 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>DetailsView Caption and CaptionAlign Example</title>
</head>
<body>
    <form id="Form1" runat="server">
        
      <h3>DetailsView Caption and CaptionAlign Example</h3>
                
        <asp:detailsview id="CustomerDetailView"
          datasourceid="DetailsViewSource"
          datakeynames="CustomerID"
          autogeneraterows="true"
          allowpaging="true"
          caption="Customer Details"
          captionalign="Left"  
          runat="server">
               
          <headerstyle backcolor="Navy"
            forecolor="White"/>
                    
        </asp:detailsview>
        
        <!-- 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="DetailsViewSource" runat="server" 
          ConnectionString=
            "<%$ ConnectionStrings:NorthWindConnectionString%>"
          InsertCommand="INSERT INTO [Customers]([CustomerID], 
            [CompanyName], [Address], [City], [PostalCode], [Country]) 
            VALUES (@CustomerID, @CompanyName, @Address, @City, 
            @PostalCode, @Country)"
          SelectCommand="Select [CustomerID], [CompanyName], 
            [Address], [City], [PostalCode], [Country] 
            From [Customers]">
        </asp:SqlDataSource>
    </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>DetailsView Caption and CaptionAlign Example</title>
</head>
<body>
    <form id="Form1" runat="server">
        
      <h3>DetailsView Caption and CaptionAlign Example</h3>
                
        <asp:detailsview id="CustomerDetailView"
          datasourceid="DetailsViewSource"
          datakeynames="CustomerID"
          autogeneraterows="true"
          allowpaging="true"
          caption="Customer Details"
          captionalign="Left"  
          runat="server">
               
          <headerstyle backcolor="Navy"
            forecolor="White"/>
                    
        </asp:detailsview>
        
        <!-- 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="DetailsViewSource" runat="server" 
          ConnectionString=
            "<%$ ConnectionStrings:NorthWindConnectionString%>"
          InsertCommand="INSERT INTO [Customers]([CustomerID], 
            [CompanyName], [Address], [City], [PostalCode], [Country]) 
            VALUES (@CustomerID, @CompanyName, @Address, @City, 
            @PostalCode, @Country)"
          SelectCommand="Select [CustomerID], [CompanyName], 
            [Address], [City], [PostalCode], [Country] 
            From [Customers]">
        </asp:SqlDataSource>
    </form>
  </body>
</html>

설명

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

컨트롤에 DetailsView 대한 추가 접근성 지원은 속성에서 CaptionAlign 제공합니다. 컨트롤에서 CaptionAlign HTML 캡션 요소 DetailsView 의 맞춤을 지정하려면 이 속성을 사용합니다.

Caption 은 뷰 상태에 저장됩니다.

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

적용 대상

추가 정보