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_CheckBoxes
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
'Apply event-handling method
AddHandler cmdPostBack.Click, AddressOf cmdPostBack_Click
End Sub
Private Sub cmdPostBack_Click(ByVal sender As Object, ByVal e As EventArgs)
'Create collection of elements
myTreeView.DataBind()
'Get Checked Items
Dim CheckedItems As String = ""
Dim myCheckedItems As ArrayList = myTreeView.GetCheckedItems()
For i As Integer = 0 To myCheckedItems.Count - 1
Dim myItem As TreeViewElement = CType(myCheckedItems(i), TreeViewElement)
CheckedItems &= myItem.title & " (" & _
myItem.id & ") " & _
"<br/>"
Next i
'Display Checked Items
lblCheckedItems.Text = CheckedItems
End Sub
End Class
|