TreeNodeBindingCollection.RemoveAt メソッド
アセンブリ: System.Web (system.web.dll 内)


RemoveAt メソッドを使用して、index にある TreeNodeBinding オブジェクトを TreeNodeBindingCollection オブジェクトから削除します。そのノードの後に続く項目はすべて、空いた位置を埋め合わせるように上に移動します。移動した項目のインデックスも更新されます。
または、Remove メソッドを使用して、特定の TreeNodeBinding オブジェクトを削除することもできます。Clear メソッドを使用して、コレクション内のすべてのノードを削除することもできます。

RemoveAt メソッドを使用して、TreeNodeBindingCollection オブジェクトから TreeNodeBinding オブジェクトをプログラムによって削除するコード例を次に示します。この例を正しく実行するには、このセクションの末尾にある XML データを Book.xml ファイルにコピーする必要があります。
<%@ Page Language="vb" %> <script runat="server"> Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) ' Use the RemoveAt method to remove the TreeNodeBinding object ' for the third-level nodes (index 2). BookTreeView.DataBindings.RemoveAt(2) ' Create a new TreeNodeBinding object and set its properties. Dim newBinding As TreeNodeBinding = New TreeNodeBinding newBinding.DataMember = "Section" newBinding.TextField = "Subject" ' Use the Insert method to insert the TreeNodeBinding object to ' the DataBindings collection at index 2. BookTreeView.DataBindings.Insert(2, newBinding) End Sub </script> <html> <body> <form runat="server"> <h3>TreeNodeBindingCollection Insert and RemoveAt Example</h3> <asp:TreeView id="BookTreeView" DataSourceID="BookXmlDataSource" runat="server"> <DataBindings> <asp:TreeNodeBinding DataMember="Book" TextField="Title"/> <asp:TreeNodeBinding DataMember="Chapter" TextField="Heading"/> <asp:TreeNodeBinding DataMember="Section" TextField="Heading"/> </DataBindings> </asp:TreeView> <asp:XmlDataSource id="BookXmlDataSource" DataFile="Book.xml" runat="server"> </asp:XmlDataSource> </form> </body> </html>
<%@ Page Language="C#" %> <script runat="server"> void Page_Load(Object sender, EventArgs e) { // Use the RemoveAt method to remove the TreeNodeBinding object // for the third-level nodes (index 2). BookTreeView.DataBindings.RemoveAt(2); // Create a new TreeNodeBinding object and set its properties. TreeNodeBinding newBinding = new TreeNodeBinding(); newBinding.DataMember = "Section"; newBinding.TextField = "Subject"; // Use the Insert method to insert the TreeNodeBinding object // into the DaaBindings collection at index 2. BookTreeView.DataBindings.Insert(2, newBinding); } </script> <html> <body> <form runat="server"> <h3>TreeNodeBindingCollection Insert and RemoveAt Example</h3> <asp:TreeView id="BookTreeView" DataSourceID="BookXmlDataSource" runat="server"> <DataBindings> <asp:TreeNodeBinding DataMember="Book" TextField="Title"/> <asp:TreeNodeBinding DataMember="Chapter" TextField="Heading"/> <asp:TreeNodeBinding DataMember="Section" TextField="Heading"/> </DataBindings> </asp:TreeView> <asp:XmlDataSource id="BookXmlDataSource" DataFile="Book.xml" runat="server"> </asp:XmlDataSource> </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に収録されているすべての辞書からTreeNodeBindingCollection.RemoveAt メソッドを検索する場合は、下記のリンクをクリックしてください。

- TreeNodeBindingCollection.RemoveAt メソッドのページへのリンク