MenuItem.ValuePath 속성

정의

루트 메뉴 항목에서 현재 메뉴 항목까지의 경로를 가져옵니다.

public:
 property System::String ^ ValuePath { System::String ^ get(); };
[System.ComponentModel.Browsable(false)]
public string ValuePath { get; }
[<System.ComponentModel.Browsable(false)>]
member this.ValuePath : string
Public ReadOnly Property ValuePath As String

속성 값

String

루트 메뉴 항목에서 현재 메뉴 항목까지의 경로를 형성하는 메뉴 항목 값의 구분 기호로 구분된 목록입니다.

특성

예제

다음 예제에서는 값을 구문 분석 하는 방법에 설명 합니다 ValuePath 개별 메뉴 항목 값에 대 한 속성입니다.


<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

  void Page_Load(Object sender, EventArgs e)
  {
    // Get the Classical menu item using the Items
    // and ChildItems collections.
    MenuItem item = NavigationMenu.Items[0].ChildItems[0].ChildItems[0];

    // Create the delimiter array using the PathSeparator value.
    // This array is used by the Split method to parse the
    // value path string. 
    Char[] DelimiterArray = new Char[1];
    DelimiterArray[0] = NavigationMenu.PathSeparator;
    
    // Parse the value path of the Classical menu item 
    // using the Split method.
    String[] nodeValues = item.ValuePath.Split(DelimiterArray);
    
    // Display the original and parsed values.
    Message.Text = "The original value path for the Classical menu item is <b>" + 
      item.ValuePath + "</b>.<br/>";
    Message.Text += "The individual values that make up the value " +
      "path are: <br/>";

    foreach (String menuValue in nodeValues)
    {
      Message.Text += "- <b>" + menuValue + "</b><br/>";
    } 
  }
    
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>MenuItem ValuePath Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <h3>MenuItem ValuePath Example</h3>
    
      <asp:menu id="NavigationMenu"
        staticdisplaylevels="1"
        staticsubmenuindent="10" 
        orientation="Vertical" 
        runat="server">

        <items>
          <asp:menuitem text="Home"
            tooltip="Home">
            <asp:menuitem text="Music"
              tooltip="Music">
              <asp:menuitem text="Classical"
                tooltip="Classical"/>
              <asp:menuitem text="Rock"
                tooltip="Rock"/>
              <asp:menuitem text="Jazz"
                tooltip="Jazz"/>
            </asp:menuitem>
            <asp:menuitem text="Movies"
              tooltip="Movies">
              <asp:menuitem text="Action"
                tooltip="Action"/>
              <asp:menuitem text="Drama"
                tooltip="Drama"/>
              <asp:menuitem text="Musical"
                tooltip="Musical"/>
            </asp:menuitem>
          </asp:menuitem>
        </items>
      
      </asp:menu>
      
      <hr/>
      
      <asp:label id="Message" 
        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">
<script runat="server">

  Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

    ' Get the Classical menu item using the Items
    ' and ChildItems collections.
    Dim item As MenuItem = NavigationMenu.Items(0).ChildItems(0).ChildItems(0)

    ' Create the delimiter array using the PathSeparator value.
    ' This array is used by the Split method to parse the
    ' value path string. 
    Dim DelimiterArray(1) As Char
    DelimiterArray(0) = NavigationMenu.PathSeparator
    
    ' Parse the value path of the Classical menu item 
    ' using the Split method.
    Dim nodeValues() As String = item.ValuePath.Split(DelimiterArray)
    
    ' Display the original and parsed values.
    Message.Text = "The original value path for the Classical menu item is <b>" & _
      item.ValuePath & "</b>.<br/>"
    Message.Text &= "The individual values that make up the value " & _
      "path are: <br/>"

    Dim menuValue As String
    For Each menuValue In nodeValues
    
      Message.Text &= "- <b>" & menuValue & "</b><br/>"
    
    Next
    
  End Sub
    
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>MenuItem ValuePath Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <h3>MenuItem ValuePath Example</h3>
    
      <asp:menu id="NavigationMenu"
        staticdisplaylevels="1"
        staticsubmenuindent="10" 
        orientation="Vertical" 
        runat="server">

        <items>
          <asp:menuitem text="Home"
            tooltip="Home">
            <asp:menuitem text="Music"
              tooltip="Music">
              <asp:menuitem text="Classical"
                tooltip="Classical"/>
              <asp:menuitem text="Rock"
                tooltip="Rock"/>
              <asp:menuitem text="Jazz"
                tooltip="Jazz"/>
            </asp:menuitem>
            <asp:menuitem text="Movies"
              tooltip="Movies">
              <asp:menuitem text="Action"
                tooltip="Action"/>
              <asp:menuitem text="Drama"
                tooltip="Drama"/>
              <asp:menuitem text="Musical"
                tooltip="Musical"/>
            </asp:menuitem>
          </asp:menuitem>
        </items>
      
      </asp:menu>
      
      <hr/>
      
      <asp:label id="Message" 
        runat="server"/>

    </form>
  </body>
</html>

설명

ValuePath 속성 루트 메뉴 항목을 현재 메뉴 항목 까지의 경로 구성 하는 메뉴 항목 값의 구분 기호로 구분 된 목록을 포함 합니다. 값 경로에서 메뉴 항목의 위치를 나타내는 데 사용 되는 Menu 제어 합니다. 사용 하 여 메뉴 항목 값을 구분 하는 데 구분 기호 문자를 지정할 수는 PathSeparator 속성입니다. 개별 값 또는 인수로 전달할 목록을 구문 분석할 때이 값은 일반적으로 사용 됩니다는 FindItem 메서드는 TreeView 클래스입니다. 에 표시 되는 값에 따라는 Menu 컨트롤, 구분 기호 문자 충돌을 방지 하기 위해 변경 해야 할 수 있습니다. 예를 들어 쉼표로 구분 기호 문자를 설정 하는 경우 표시 되는 값 없어야 쉼표가; 그렇지 않은 경우 정확 하 게 구문 분석할 수는 ValuePath 속성입니다.

참고

값을 Value 현재 메뉴 항목에 루트 메뉴 항목에서 각 메뉴 항목의 속성 값 경로 만드는 데 사용 됩니다. 메뉴 항목 동일 메뉴 수준에서 각 있어야에 고유한 값을 합니다 Value 속성, Menu 컨트롤 같은 값이 있는 동일한 수준의 다른 메뉴 항목을 구분할 수 없습니다.

적용 대상

추가 정보