I am attempting to use an Ajax TreeView component from ComponetOne and have created a TreeView.ascx contol. I can load the treeview control fine and load some initial items but I would like to load the tree dynamically using the PopulateOnDemand feature. The problem I have is that when I click on a tree item the ItemPopulate event never fires. I’ve tested this same structre outside of DNN with a webpage .aspx and control .ascx with the treeview and everything works as exected – so I suspect it has something to do with the DNN structure. Below is my code in the .ascx
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
If Session("ResourceItem") IsNot Nothing Then
Session("CurrentPath") = Path.GetDirectoryName(CType(Session("ResourceItem"), ResourceItem).FullName)
Session("ResourceItem") = Nothing
End If
Dim thePath As String
thePath = Session("CurrentPath")
If String.IsNullOrEmpty(thePath) Then
thePath = Me._RootPath
Else
If Not thePath.EndsWith("\") Then thePath += "\"
If Not Me._RootPath.EndsWith("\") Then Me._RootPath += "\"
End If
LoadResources(thePath)
End If
End Sub
Private Sub LoadResources(ByVal thePath As String, Optional ByVal ItemToLoad As C1.Web.Command.C1WebTreeViewItem = Nothing)
Dim itm As C1.Web.Command.C1WebTreeViewItem
Dim rc As New ResourceCollection
rc.UserInfo = Me._UserInfo
rc.ReadPath(thePath)
For Each ri As ResourceItem In rc
itm = New C1.Web.Command.C1WebTreeViewItem
itm.PopulateOnDemand = True
itm.Text = ri.DisplayName
itm.CommandArgument = ri.FullName
If IsNothing(ItemToLoad) Then
Me.C1WebTreeView1.Items.Add(itm)
Else
If IsNothing(ItemToLoad.ChildGroup) Then ItemToLoad.CreateChildGroup()
ItemToLoad.ChildGroup.Items.Add(itm)
End If
Next
End Sub
Protected Sub C1WebTreeView1_ItemPopulate(ByVal sender As Object, ByVal e As C1.Web.Command.C1WebCommandEventArgs) Handles C1WebTreeView1.ItemPopulate
LoadResources(e.CommandArgument, e.Item)
End Sub
thx for any help
-Tom