Imports System
Imports System.Data
Imports System.Configuration
Imports System.Collections
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Xml
Imports APNSoft.WebControls
Partial Public Class TreeView_PopulateDynamically
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
'Set empty DataSource from XmlDocument
myTreeView.DataSource = New XmlDocument()
myTreeView.DataBind()
'Get elements collection
Dim _Elements As TreeViewElementCollection = myTreeView.Elements
'Add root elements
_Elements.AddRootItem("Home")
Dim _AboutUs As TreeViewElement = _Elements.AddRootItem("About Us")
_Elements.AddRootItem("Products")
_Elements.AddRootItem("Solutions")
'Add child nodes for "About Us"
_AboutUs.AddChildItem("Awards")
_AboutUs.AddChildItem("Certificates")
Dim _ContactUs As TreeViewElement = _AboutUs.AddChildItem("Contact Us")
_AboutUs.AddChildItem("Financial Highlights")
_AboutUs.AddChildItem("History")
'Add child nodes for "Contact Us"
_ContactUs.AddChildItem("Call Us")
_ContactUs.AddChildItem("E-mail Us")
End Sub
End Class
|