Rank: Member Groups: Member
Joined: 12/5/2008 Posts: 27
|
Hello Support,
I am using the Treeview in one of the user controls and building the nodes and subgroup dynamically. I need to get the nodes valus when the Node is selected but cannot seem to get it?
Here is my code that builds the treenodes when the control loads. I pass a small data set to the procedure.
Any help is greatly appreciated as you guy's always respond quickly.
Thanks,
Bill Birt Sr. MedExpress Information Systems
Private Sub TreeMaker(ByVal ds As DataSet) Try TreeView1.Nodes.Clear()
Dim i As Integer = 0 Dim j As Integer = 0 For i = 0 To ds.Tables(0).Rows.Count Dim pcol = "<b><i>(" & ds.Tables(0).Rows(i)("InsPriority").ToString & ")</b></i> -" & ds.Tables(0).Rows(i)("ICName").ToString Dim parentnode As EO.Web.TreeNode = New EO.Web.TreeNode(pcol) ' parentnode.Text = ds.Tables(0).Rows(i)("InsPriority").ToString 'parentnode.Text = ds.Tables(0).Rows(i)("ICName").ToString parentnode.SelectedStyle.BackColor = Drawing.Color.LightYellow parentnode.SelectedStyle.ForeColor = Drawing.Color.DarkBlue TreeView1.Nodes.Add(parentnode) TreeView1.SingleExpandMode = EO.Web.TreeViewSingleExpandMode.TopLevelOnly ' build the display layout in the treeview node For j = 0 To ds.Tables(0).Columns.Count - 1 Dim sCol = ds.Tables(0).Columns(j).ToString & ": " & ds.Tables(0).Rows(i).Item(j).ToString Dim scolValue = ds.Tables(0).Rows(i).Item(j).ToString Dim childnode As New EO.Web.TreeNode(sCol) If scolValue = "" Or Len(scolValue) = 0 Then GoTo skip_node ' parentnode.SubGroup.Nodes.Add(childnode) Else parentnode.SubGroup.Nodes.Add(childnode) End If skip_node:
Next Next
Catch ex As Exception
End Try
End Sub
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
We are not in a position to trouble shoot your code, so we can only give you general instructions. When you create the TreeView dynamically, you should only create it once during initial load and not during post back if you wish the TreeView to retain its status information (such as Expanded state, SelectedNode, etc). So you should check that if you are losing SelectedNode.
Thanks
|