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

Dim instance As TreeNodeBindingCollection Dim index As Integer Dim binding As TreeNodeBinding instance.Insert(index, binding)

指定した TreeNodeBinding オブジェクトを index の位置にある TreeNodeBindingCollection オブジェクトに挿入するには、Insert メソッドを使用します。
または、Add メソッドを使用して、TreeNodeBinding オブジェクトを TreeNodeBindingCollection の末尾に追加することもできます。

Insert メソッドを使用して、プログラムによって新しい TreeNodeBinding オブジェクトを TreeNodeBindingCollection オブジェクトに挿入するコード例を次に示します。この例を正しく実行するには、このセクションの末尾にある 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.Insert メソッドを検索する場合は、下記のリンクをクリックしてください。

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