Hi,
This is regarding the ASPXTrrList view. I would like to get the selected node value. But I need to fetch the ID instead of the Value.
Herewith I have attached a sample image for my TreeList. Whenever the user click on the node then we need to fetch the selected node value. (i.e same like drop down selection)
FYI…
Here is the FE code what we are using for our application.
Dim treeListAnalysis As ASPxTreeList = CType(cboTreeView.FindControl("tvUserTree"), ASPxTreeList)
Dim rootNode As TreeListNode = Nothing
Dim taskType As String = Nothing
Dim rootValue As Integer = 0
userList = TaskListManager.GetTreeListView()
configXML = CType(Profile.DocTas.Web.Common.GetCache(), XmlDocument)
nodeList = configXML.SelectNodes("XXX/YYYY/NODE")
For loopCounter = 0 To nodeList.Count - 1
For innerLoopCounter = 0 To nodeList(loopCounter).ChildNodes.Count - 1
rootNode = treeListAnalysis.AppendNode(rootValue)
rootNode.SetValue("name", nodeList(loopCounter).ChildNodes(innerLoopCounter).ChildNodes(0).InnerXml)
rootValue = rootValue + 1
If nodeList(loopCounter).ChildNodes(innerLoopCounter).ChildNodes(0).InnerXml = "Other Departments Task" Then
taskType = "Department"
Dim userSelection = From value In userList Where taskType.Equals(value.UserType)
For Each result In userSelection
treeListAnalysis.AppendNode(rootValue, rootNode).SetValue("name", result.UserName)
rootValue = rootValue + 1
Next
End If
If nodeList(loopCounter).ChildNodes(innerLoopCounter).ChildNodes(0).InnerXml = "Other Teams Task" Then
taskType = "Team"
Dim userSelection = From value In userList Where taskType.Equals(value.UserType)
For Each result In userSelection
treeListAnalysis.AppendNode(rootValue, rootNode).SetValue("name", result.UserName)
rootValue = rootValue + 1
Next
End If
Next
Next
I am awaiting for your reply.
Thanks,
Vinoth Kumar R
ASPxTreeList - How to iterate through selected nodes
Answers approved by DevExpress Support
Hello Vinoth,
Thank you for sending the code block to me. I have examined it and suggest that you modify your scenario a little. Since it is necessary to iterate through the ASPxTreeList's ASPxTreeList.Nodes collection, it is recommended to use the TreeListNodeIterator.
Please use the approach, illustrated in the OBSOLETE: How to change the style of a parent node's selection checkbox if some of its child nodes are selected Code Central example, as a starting point to accomplish this task (the ASPxTreeList1_SelectionChanged event handler).
Thanks,
Mike