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_ServerSelection
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
        'Apply event-handling method
        AddHandler myTreeView.OnItemClick, AddressOf myTreeView_OnItemClick
    End Sub


    Private Sub myTreeView_OnItemClick(ByVal sender As Object, ByVal e As APNSoft.WebControls.TreeViewEventArgs)
        'Get component instance
        Dim myTreeView As APNSoftTreeView = CType(sender, APNSoftTreeView)

        'Get clicked Item
        Dim myItem As TreeViewElement = e.TreeViewElement

        'Display clicked item data
        Dim ClickedItem As String = ""
        ClickedItem &= "Component ID: <b>" & _
            myTreeView.ID & "</b>"
        ClickedItem &= "<br/>Item ID: <b>" & _
            myItem.id & "</b>"
        ClickedItem &= "<br/>Item title: <b>" & _
            myItem.title & "</b><br/><br/>"
        lblClickedItem.Text = ClickedItem
    End Sub
End Class