Repopulate TreeView

J

JN

Hi All,

When an update is made to the gridview, I need to get rid of the current
treeview and repopulate it with the changes.

How do I get rid of the current treeview?

Here is the code that populates the treeview when the page is first loaded.


Sub PopulateNodesSimEx()
Dim dst As DataSet = GetTreeViewData()

Dim masterNode As New TreeNode("SimEx Inc.")

TreeView1.Nodes.Add(masterNode)


For Each childRow As DataRow In dst.Tables("tbDepartmentsSimEx").Rows

Dim childNode As New TreeNode(childRow("SimExDepartment").ToString())

masterNode.ChildNodes.Add(childNode)


For Each childRow1 As DataRow In childRow.GetChildRows("ChildrenSimEx")

Dim childNode1 As New TreeNode(childRow1("FullName").ToString())

childNode.ChildNodes.Add(childNode1)

Next

Next


Thanks.
JN
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top