MenuItemBindingCollection.Item プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > MenuItemBindingCollection.Item プロパティの意味・解説 

MenuItemBindingCollection.Item プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

指定されインデックス位置にあるMenuItemBinding オブジェクトコレクションから取得します

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Default Property
 Item ( _
    i As Integer _
) As MenuItemBinding
Dim instance As MenuItemBindingCollection
Dim i As Integer
Dim value As MenuItemBinding

value = instance(i)

instance(i) = value
public MenuItemBinding this [
    int i
] { get; set; }
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)

パラメータ

i

取得する MenuItemBinding の、0 から始まるインデックス番号

プロパティ
コレクション内の指定されインデックス位置にある 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"

title="Home"

description="Home">

<MapNode url="~\Music.aspx"

title="Music"

description="Music">

<MapNode url="~\Classical.aspx"

title="Classical"

description="Classical"/>

<MapNode url="~\Rock.aspx"

title="Rock"

description="Rock"/>

<MapNode url="~\Jazz.aspx"

title="Jazz"

description="Jazz"/>

</MapNode>

<MapNode url="~\Movies.aspx"

title="Movies"

description="Movies">

<MapNode url="~\Action.aspx"

title="Action"

description="Action"/>

<MapNode url="~\Drama.aspx"

title="Drama"

description="Drama"/>

<MapNode url="~\Musical.aspx"

title="Musical"

description="Musical"/>

</MapNode>

</MapHomeNode>

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
MenuItemBindingCollection クラス
MenuItemBindingCollection メンバ
System.Web.UI.WebControls 名前空間
Menu クラス
MenuItem クラス
MenuItemBinding クラス
Menu.DataBindings プロパティ
CopyTo
GetEnumerator



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

MenuItemBindingCollection.Item プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



MenuItemBindingCollection.Item プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS