BulletedList.Target 속성

정의

컨트롤의 하이퍼링크를 클릭할 때 연결된 웹 페이지 콘텐츠를 표시할 대상 창 또는 프레임을 BulletedList 가져오거나 설정합니다.

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

속성 값

하이퍼링크 BulletedList 를 클릭할 때 연결된 웹 페이지를 로드할 대상 창 또는 프레임입니다. 기본값은 빈 문자열("")입니다.

특성

예제

다음 코드 예제에서는 컨트롤을 BulletedList 만들고 속성을 설정 하는 방법을 보여 줍니다 Target . 사용자가 목록 상자 Target 에서 표시 모드를 선택하면 HyperLink 속성이 새 브라우저 창에 연결된 페이지를 표시하도록 _blank 설정됩니다.

<%@ 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>DisplayMode Example</title>
<script runat="server">
  
  void Index_Changed(object sender, System.EventArgs e)
  {

      // Change the message displayed, based on 
      // the display mode selected from the list box.
      if (DisplayModeListBox.SelectedIndex > -1)
      {
          Message1.Text = "You chose: " + DisplayModeListBox.SelectedItem.Text;
      }

      // Change the display mode, based on 
      // the mode selected from the list box.
      switch (DisplayModeListBox.SelectedIndex) 
    {
          case 0:
              ItemsBulletedList.DisplayMode = BulletedListDisplayMode.Text;
              Message2.Text = "";
              break;
          case 1:
              ItemsBulletedList.DisplayMode = BulletedListDisplayMode.HyperLink;
              // Opens a new browser window to display the page linked to.
              ItemsBulletedList.Target = "_blank";
              Message2.Text = "";
              break;
          case 2:
              ItemsBulletedList.DisplayMode = BulletedListDisplayMode.LinkButton;
              break;
          default:
              throw new Exception("You did not select a valid display mode.");
              break;
      }

  }

  void ItemsBulletedList_Click(object sender, System.Web.UI.WebControls.BulletedListEventArgs e)
  {

      // Change the message displayed, based on the index
      // of the bulletedlist list item that was clicked.
      switch (e.Index) 
    {
          case 0:
              Message2.Text = "You  clicked list item 1.";
              break;
          case 1:
              Message2.Text = "You  clicked list item 2.";
              break;
          case 2:
              Message2.Text = "You  clicked list item 3.";
              break;
          default:
              throw new Exception("You did not click a valid list item.");
              break;
      }

  }

</script>

</head>
<body>

  <h3>DisplayMode Example</h3>

  <form id="form1" runat="server">

    <h3>BulletedListDisplayMode Example</h3>

    <p>
    <asp:BulletedList id="ItemsBulletedList" 
      BulletStyle="Disc"
      DisplayMode="Text" 
      OnClick="ItemsBulletedList_Click"
      runat="server">    
      <asp:ListItem Value="http://www.cohowinery.com">Coho Winery</asp:ListItem>
      <asp:ListItem Value="http://www.contoso.com">Contoso, Ltd.</asp:ListItem>
      <asp:ListItem Value="http://www.tailspintoys.com">Tailspin Toys</asp:ListItem>
    </asp:BulletedList></p>

    <hr />

    <h4>Select from the list to change the display mode:</h4>
    <asp:ListBox id="DisplayModeListBox" 
      Rows="1"
      SelectionMode="Single"
      AutoPostBack="True"
      OnSelectedIndexChanged="Index_Changed"
      runat="server">
        <asp:ListItem>Text</asp:ListItem>
        <asp:ListItem>Hyperlink</asp:ListItem>
        <asp:ListItem>LinkButton</asp:ListItem>
    </asp:ListBox>

    <asp:Label id="Message1" 
      runat="server"
      AssociatedControlID="DisplayModeListBox"/><br /><br />

    <asp:Label id="Message2"
      runat="server"
      AssociatedControlID="DisplayModeListBox"/>

   </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>DisplayMode Example</title>
<script runat="server">

  Sub Index_Changed(ByVal sender As Object, ByVal e As System.EventArgs)

    ' Change the message displayed, based on 
    ' the display mode selected from the list box.
    If DisplayModeListBox.SelectedIndex > -1 Then
      Message1.Text = "You chose: " & DisplayModeListBox.SelectedItem.Text
    End If

    ' Change the display mode, based on 
    ' the mode selected from the list box.
    Select Case (DisplayModeListBox.SelectedIndex)
      Case 0
        ItemsBulletedList.DisplayMode = BulletedListDisplayMode.Text
        Message2.Text = ""
      Case 1
        ItemsBulletedList.DisplayMode = BulletedListDisplayMode.HyperLink
        ' Opens a new browser window to display the page linked to.
        ItemsBulletedList.Target = "_blank"
        Message2.Text = ""
      Case 2
        ItemsBulletedList.DisplayMode = BulletedListDisplayMode.LinkButton
      Case Else
        Throw New Exception("You did not select a valid display mode.")
    End Select

  End Sub

  Sub ItemsBulletedList_Click(ByVal sender As Object, _
                              ByVal e As System.Web.UI.WebControls.BulletedListEventArgs)

    ' Change the message displayed, based on the index
    ' of the bulletedlist list item that was clicked.
    Select Case (e.Index)
      Case 0
        Message2.Text = "You  clicked list item 1."
      Case 1
        Message2.Text = "You  clicked list item 2."
      Case 2
        Message2.Text = "You  clicked list item 3."
      Case Else
        Throw New Exception("You did not click a valid list item.")
    End Select

  End Sub

</script>

</head>
<body>

  <h3>DisplayMode Example</h3>

  <form id="form1" runat="server">

    <h3>BulletedListDisplayMode Example</h3>

    <p>
    <asp:BulletedList id="ItemsBulletedList" 
      BulletStyle="Disc"
      DisplayMode="Text" 
      OnClick="ItemsBulletedList_Click"
      runat="server">    
      <asp:ListItem Value="http://www.cohowinery.com">Coho Winery</asp:ListItem>
      <asp:ListItem Value="http://www.contoso.com">Contoso, Ltd.</asp:ListItem>
      <asp:ListItem Value="http://www.tailspintoys.com">Tailspin Toys</asp:ListItem>
    </asp:BulletedList></p>

    <hr />

    <h4>Select from the list to change the display mode:</h4>
    <asp:ListBox id="DisplayModeListBox" 
      Rows="1"
      SelectionMode="Single"
      AutoPostBack="True"
      OnSelectedIndexChanged="Index_Changed"
      runat="server">
        <asp:ListItem>Text</asp:ListItem>
        <asp:ListItem>Hyperlink</asp:ListItem>
        <asp:ListItem>LinkButton</asp:ListItem>
    </asp:ListBox>

    <asp:Label id="Message1" 
      runat="server"
      AssociatedControlID="DisplayModeListBox"/><br /><br />

    <asp:Label id="Message2"
      runat="server"
      AssociatedControlID="DisplayModeListBox"/>

   </form>

</body>
</html>

설명

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

가치 설명
_blank 프레임 없이 새 창에서 콘텐츠를 렌더링합니다.
_parent 즉시 프레임 집합 부모에서 콘텐츠를 렌더링합니다.
_search 검색 창에서 콘텐츠를 렌더링합니다.
_self 포커스를 사용하여 프레임의 콘텐츠를 렌더링합니다.
_top 프레임 없이 전체 창에서 콘텐츠를 렌더링합니다.

메모

브라우저 설명서를 확인하여 값이 _search 지원되는지 확인합니다. 예를 들어 Microsoft Internet Explorer 5.0 이상에서는 _search 대상 값을 지원합니다.

컨트롤의 Target 하이퍼링크 BulletedList 를 클릭할 때 연결된 웹 페이지를 표시하는 프레임 또는 창을 지정하려면 이 속성을 사용합니다. 목록 항목의 내용을 컨트롤의 하이퍼링크 BulletedList 로 표시하려면 속성을 값HyperLink으로 설정합니다BulletedListDisplayMode. 그런 다음 각 목록 항목의 속성을 탐색할 웹 페이지의 URL로 설정합니다 Value .

Target 속성을 설정하지 않으면 하이퍼링크를 클릭하면 포커스가 있는 브라우저 또는 창이 새로 고쳐집니다.

메모

속성은 Target 특성으로 target 렌더링됩니다. target XHTML 1.1 문서 형식 정의에서는 요소의 특성 anchor 이 허용되지 않습니다. 렌더링된 출력 BulletedListTarget XHTML 1.1을 준수해야 하는 경우 속성을 설정하지 마세요. 자세한 내용은 Visual Studio 및 ASP.NET XHTML 표준 항목을 참조하세요.

액세스 가능한 웹 페이지를 만들 때 속성을 사용하여 Target 다른 창을 대상으로 지정하지 않는 것이 좋습니다. 자세한 내용은 Visual Studio 및 ASP.NET 접근성을 참조하세요.

이 속성의 값은 뷰 상태에 저장됩니다.

적용 대상

추가 정보