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 APNSoft.WebControls
Partial Public Class TreeView_PopulateDatabase
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
'Define SQL query
Dim SqlQuery As String = "SELECT * FROM Items ORDER BY id"
'Get DataTable (MS Access Database)
Dim myDataSource As DataTable = DataBase.GetDataTableOleDb(SqlQuery, "~/TreeView/DataBases/dbItems.mdb")
'Bind DataTable to the TreeView
myTreeView.DataSource = myDataSource
myTreeView.DataBind()
'Set 1st element opened (always)
Dim myTreeViewElement As TreeViewElement = myTreeView.Elements(0)
If myTreeViewElement IsNot Nothing Then
myTreeViewElement.opened = True
End If
End Sub
End Class
|