HyperLinkField.Target 속성

정의

HyperLinkField 개체의 하이퍼링크를 클릭할 때 링크되는 웹 페이지를 표시할 대상 창이나 프레임을 가져오거나 설정합니다.

public:
 virtual property System::String ^ Target { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.TypeConverter(typeof(System.Web.UI.WebControls.TargetConverter))]
public virtual string Target { get; set; }
[<System.ComponentModel.TypeConverter(typeof(System.Web.UI.WebControls.TargetConverter))>]
member this.Target : string with get, set
Public Overridable Property Target As String

속성 값

String

HyperLinkField의 하이퍼링크를 클릭할 경우 링크되는 웹 페이지를 로드할 대상 창 또는 프레임입니다. 기본값은 빈 문자열("")로, 이 속성이 설정되어 있지 않음을 나타냅니다.

특성

예제

다음 코드 예제를 사용 하는 방법에 설명 합니다 Target 속성의 하이퍼링크를 사용 하 여 연결 된 웹 페이지의 내용을 표시할 대상 창 지정을 HyperLinkField 개체입니다. 연결된 된 웹 페이지는 하이퍼링크를 클릭할 때 새 창에 표시 됩니다.


<%@ 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>HyperLinkField Example</title>
</head>
<body>
    <form id="form1" runat="server">
        
      <h3>HyperLinkField Example</h3>
                    
      <!-- Populate the Columns collection declaratively. -->
      <!-- Set the HyperLinkField field column to a static     -->
      <!-- caption and URL.                                    -->
      <asp:gridview id="OrdersGridView" 
        datasourceid="OrdersSqlDataSource" 
        autogeneratecolumns="false"
        runat="server">
                
        <columns>
                
          <asp:boundfield datafield="OrderID" 
            headertext="OrderID"/>
          <asp:boundfield datafield="CustomerID" 
            headertext="Customer ID"/>
          <asp:boundfield datafield="OrderDate" 
            headertext="Order Date"
            dataformatstring="{0:d}" />
          <asp:hyperlinkfield text="Details..."
            navigateurl="~\details.aspx"            
            headertext="Order Details"
            target="_blank" />
                
        </columns>
                
      </asp:gridview>
            
      <!-- This example uses Microsoft SQL Server and connects -->
      <!-- to the Northwind sample database.                   -->
      <asp:sqldatasource id="OrdersSqlDataSource"  
        selectcommand="SELECT [OrderID], [CustomerID], [OrderDate] FROM [Orders]"
        connectionstring="server=localhost;database=northwind;integrated security=SSPI"
        runat="server">
      </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>HyperLinkField Example</title>
</head>
<body>
    <form id="form1" runat="server">
        
      <h3>HyperLinkField Example</h3>
                    
      <!-- Populate the Columns collection declaratively. -->
      <!-- Set the HyperLinkField field column to a static     -->
      <!-- caption and URL.                                    -->
      <asp:gridview id="OrdersGridView" 
        datasourceid="OrdersSqlDataSource" 
        autogeneratecolumns="false"
        runat="server">
                
        <columns>
                
          <asp:boundfield datafield="OrderID" 
            headertext="OrderID"/>
          <asp:boundfield datafield="CustomerID" 
            headertext="Customer ID"/>
          <asp:boundfield datafield="OrderDate" 
            headertext="Order Date"
            dataformatstring="{0:d}" />
          <asp:hyperlinkfield text="Details..."
            navigateurl="~\details.aspx"            
            headertext="Order Details"
            target="_blank" />
                
        </columns>
                
      </asp:gridview>
            
      <!-- This example uses Microsoft SQL Server and connects -->
      <!-- to the Northwind sample database.                   -->
      <asp:sqldatasource id="OrdersSqlDataSource"  
        selectcommand="SELECT [OrderID], [CustomerID], [OrderDate] FROM [Orders]"
        connectionstring="server=localhost;database=northwind;integrated security=SSPI"
        runat="server">
      </asp:sqldatasource>
            
    </form>
  </body>
</html>

설명

사용 하 여는 Target 속성 창이 나 프레임을 표시할 웹 콘텐츠를 지정 하는 하이퍼링크를 클릭할 때 하이퍼링크를 연결 합니다.

값은 범위의 A ~ Z (대/소문자 구분), 다음 표에 나열 된 특수 한 값을 제외 하면 밑줄로 시작 하는 각 문자로 시작 해야 합니다.

Description
_blank 콘텐츠를 프레임이 없는 새 창에 렌더링합니다.
_parent 콘텐츠를 직접 실행 프레임셋 부모에 렌더링합니다.
_search 콘텐츠를 검색 창에 렌더링합니다.
_self 콘텐츠를 포커스가 있는 프레임에 렌더링합니다.
_top 콘텐츠를 프레임이 없는 전체 창에 렌더링합니다.

참고

_search 값이 지원되는지 여부는 브라우저 설명서에서 확인하십시오. 예를 들어 Microsoft Internet Explorer 5.0 이상 버전에서는 지원는 _search 대상 값입니다.

참고

합니다 Target 속성으로 렌더링 되는 target 특성입니다. 합니다 target 특성을 anchor 요소 XHTML 1.1 문서 종류 정의에서 허용 되지 않습니다. 설정 하지 마십시오는 Target 속성 경우 렌더링된 된 출력에 대 한는 HyperLinkField 개체 XHTML 1.1 규격 이어야 합니다. 자세한 내용은 항목을 참조 XHTML 표준 Visual Studio 및 ASP.NET에입니다.

액세스할 수 있는 웹 페이지를 만들 때이 가장 좋습니다 사용 하지 마십시오는 Target 다른 창을 대상으로 하는 속성입니다. 자세한 내용은 ASP.NET 접근성을 참조하세요.

적용 대상

추가 정보