Menu.PathSeparator プロパティ
アセンブリ: System.Web (system.web.dll 内)

Dim instance As Menu Dim value As Char value = instance.PathSeparator instance.PathSeparator = value
/** @property */ public char get_PathSeparator () /** @property */ public void set_PathSeparator (char value)
メニュー項目のパスの区切り文字。既定値はスラッシュ (/) です。

Menu コントロールの各メニュー項目 (MenuItem オブジェクトで表される) には、メニュー項目の位置を指定する ValuePath プロパティがあります。値パスは、ルート メニュー項目から現在のメニュー項目までのパスを構成する複数の値を、間に区切りを入れて 1 つの文字列にしたものです。メニュー パスの値を区切るための区切り文字を指定するには、PathSeparator プロパティを使用します。通常この値は、個々の値の一覧を解析する場合に使用されます。
Menu コントロールに表示されるテキストによっては、競合を防ぐために区切り文字を変更する必要があります。たとえば、区切り文字をコンマに設定した場合は、表示テキストにコンマを入れないでください。コンマを入れると、ValuePath プロパティは正確な解析を行うことができません。

PathSeparator プロパティを使用して、メニュー項目の値パスの区切り文字をコンマに変更する方法のコード例を次に示します。
<%@ Page Language="VB" %> <script runat="server"> Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) ' The value path for a menu item is a delimited list ' of menu text values that form a path from the root ' menu item to the current menu item. ' Declare the value path to the Classical menu item using ' the delimiter character specified in the PathSeparator ' property. In this example, the delimiter character is a ' comma. Dim valuePath As String = "Home,Music,Classical" ' Use the FindItem method to get the Classical menu item using ' its value path. Dim item As MenuItem = NavigationMenu.FindItem(valuePath) ' Indicate whether the menu item was found. If Not item Is Nothing Then Message.Text = item.Text & " menu item found at depth " & _ item.Depth.ToString() & "." Else Message.Text = "Menu item not found." End If End Sub </script> <html> <body> <form runat="server"> <h3>Menu PathSeparator and FindItem Example</h3> <!-- Use the PathSeparator property to --> <!-- change the delimiter character for --> <!-- the value path of a menu item to a --> <!-- comma (,). --> <asp:menu id="NavigationMenu" staticdisplaylevels="2" staticsubmenuindent="10" orientation="Vertical" pathseparator="," 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="C#" %> <script runat="server"> void Page_Load(Object sender, EventArgs e) { // The value path for a menu item is a delimited list // of menu text values that form a path from the root // menu item to the current menu item. // Declare the value path to the Classical menu item using // the delimiter character specified in the PathSeparator // property. In this example, the delimiter character is a // comma. String valuePath = "Home,Music,Classical"; // Use the FindItem method to get the Classical menu item using // its value path. MenuItem item = NavigationMenu.FindItem(valuePath); // Indicate whether the menu item was found. if (item != null) { Message.Text = item.Text + " menu item found at depth " + item.Depth.ToString() + "."; } else { Message.Text = "Menu item not found."; } } </script> <html> <body> <form runat="server"> <h3>Menu PathSeparator and FindItem Example</h3> <!-- Use the PathSeparator property to --> <!-- change the delimiter character for --> <!-- the value path of a menu item to a --> <!-- comma (,). --> <asp:menu id="NavigationMenu" staticdisplaylevels="2" staticsubmenuindent="10" orientation="Vertical" pathseparator="," 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>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からMenu.PathSeparator プロパティを検索する場合は、下記のリンクをクリックしてください。

- Menu.PathSeparator プロパティのページへのリンク