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

Dim instance As MenuItemBindingCollection Dim i As Integer Dim value As MenuItemBinding value = instance(i) instance(i) = value
public: property MenuItemBinding^ default [int] { MenuItemBinding^ get (int i); void set (int i, MenuItemBinding^ value); }
/** @property */ public MenuItemBinding get_Item (int i) /** @property */ public void set_Item (int i, MenuItemBinding value)
プロパティ値
コレクション内の指定されたインデックス位置にある MenuItemBinding。

このインデクサを使用して、配列表記で指定したインデックス位置にある MenuItemBinding オブジェクトにコレクションからアクセスします。このインデクサを使用すると、コレクション内の MenuItemBinding オブジェクトへのアクセス、変更、または置換を直接実行できます。

インデクサを使用して MenuItemBinding オブジェクトをコレクションから取得する方法のコード例を次に示します。次に、MenuItemBinding オブジェクトのプロパティがプログラムによって更新されます。この例を正常に動作させるには、以下のサンプル XML データを、Map.xml という名前のファイルにコピーする必要があります。
<%@ Page Language="VB" %> <script runat="server"> Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) If Not IsPostBack Then ' Use the indexer to retrieve the MenuItemBinding ' object at index 0. Dim binding As MenuItemBinding = NavigationMenu.DataBindings(0) ' Instead of binding the Text property of the Home ' menu item to a field from a data source, bind it ' to static text. binding.TextField = "" binding.Text = "Custom Menu Text" End If End Sub </script> <html> <body> <form runat="server"> <h3>MenuItemBindingCollection Indexer Example</h3> <asp:menu id="NavigationMenu" staticdisplaylevels="2" staticsubmenuindent="10" orientation="Vertical" target="_blank" datasourceid="MenuSource" runat="server"> <DataBindings> <asp:menuitembinding datamember="MapHomeNode" depth="0" textfield="title" navigateurlfield="url"/> <asp:menuitembinding datamember="MapNode" depth="1" textfield="title" navigateurlfield="url"/> <asp:menuitembinding datamember="MapNode" depth="2" textfield="title" navigateurlfield="url"/> </DataBindings> </asp:menu> <asp:xmldatasource id="MenuSource" datafile="Map.xml" runat="server"/> </form> </body> </html>
<%@ Page Language="C#" %> <script runat="server"> void Page_Load(Object sender, EventArgs e) { if(!IsPostBack) { // Use the indexer to retrieve the MenuItemBinding // object at index 0. MenuItemBinding binding = NavigationMenu.DataBindings[0]; // Instead of binding the Text property of the Home // menu item to a field from a data source, bind it // to static text. binding.TextField = ""; binding.Text = "Custom Menu Text"; } } </script> <html> <body> <form runat="server"> <h3>MenuItemBindingCollection Indexer Example</h3> <asp:menu id="NavigationMenu" staticdisplaylevels="2" staticsubmenuindent="10" orientation="Vertical" target="_blank" datasourceid="MenuSource" runat="server"> <DataBindings> <asp:menuitembinding datamember="MapHomeNode" depth="0" textfield="title" navigateurlfield="url"/> <asp:menuitembinding datamember="MapNode" depth="1" textfield="title" navigateurlfield="url"/> <asp:menuitembinding datamember="MapNode" depth="2" textfield="title" navigateurlfield="url"/> </DataBindings> </asp:menu> <asp:xmldatasource id="MenuSource" datafile="Map.xml" runat="server"/> </form> </body> </html>
<MapHomeNode url="~\Home.aspx"
description="Home">
<MapNode url="~\Music.aspx"
description="Music">
<MapNode url="~\Classical.aspx"
description="Classical"/>
<MapNode url="~\Rock.aspx"
description="Rock"/>
<MapNode url="~\Jazz.aspx"
description="Jazz"/>
</MapNode>
<MapNode url="~\Movies.aspx"
<MapNode url="~\Action.aspx"
description="Action"/>
<MapNode url="~\Drama.aspx"
description="Drama"/>
<MapNode url="~\Musical.aspx"
description="Musical"/>
</MapNode>
</MapHomeNode>

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に収録されているすべての辞書からMenuItemBindingCollection.Item プロパティを検索する場合は、下記のリンクをクリックしてください。

- MenuItemBindingCollection.Item プロパティのページへのリンク