MenuItemBindingCollection.RemoveAt メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > MenuItemBindingCollection.RemoveAt メソッドの意味・解説 

MenuItemBindingCollection.RemoveAt メソッド

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

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

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

Public Sub RemoveAt ( _
    index As Integer _
)
Dim instance As MenuItemBindingCollection
Dim index As Integer

instance.RemoveAt(index)
public void RemoveAt (
    int index
)
public:
void RemoveAt (
    int index
)
public void RemoveAt (
    int index
)

パラメータ

index

削除するメニュー項目のバインディングの 0 から始まるインデックス位置

解説解説
使用例使用例

RemoveAt メソッド使用して特定のインデックス位置にある 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 RemoveAt method to remove the  
      ' MenuItemBinding object at index 3 from
      ' the Bindings collection.
      NavigationMenu.DataBindings.RemoveAt(3)
    
    End If
    
  End Sub
    
</script>

<html>
  <body>
    <form runat="server">
    
      <h3>MenuItemBindingCollection RemoveAt 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"/>
          <asp:menuitembinding datamember="ExtraMapNode"
 
            depth="3"
            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 RemoveAt method to remove the  
      // MenuItemBinding object at index 3 from
      // the Bindings collection.
      NavigationMenu.DataBindings.RemoveAt(3);
    }
  }
    
</script>

<html>
  <body>
    <form runat="server">
    
      <h3>MenuItemBindingCollection RemoveAt 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"/>
          <asp:menuitembinding datamember="ExtraMapNode" 
            depth="3"
            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 プロパティ
Clear
Add
Insert
Remove



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

辞書ショートカット

すべての辞書の索引

MenuItemBindingCollection.RemoveAt メソッドのお隣キーワード
検索ランキング

   

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



MenuItemBindingCollection.RemoveAt メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS