Welcome Guest Search | Active Topics | Sign In | Register

Treeview Selected Nodes Value Options
medis
Posted: Friday, June 19, 2009 9:26:30 AM
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
eo_support
Posted: Friday, June 19, 2009 2:33:31 PM
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


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.