I am trying to bind childnodes with Radtreeview childnode. Code works fine on localhost and on development server but not on production.
It's creating "AMB Financial Groups Lists" childnode but not populating it with its child nodes.Web server files and database tables are identical on my localhost and on production server
Private Sub PopulateProductNodes(ByRef node As RadTreeNode)
Dim ds As New DataSet
Dim cNode As RadTreeNode
'Try
For x = 0 To node.Nodes.Count - 1
If node.Nodes(x).Nodes.Count > 0 Then
PopulateProductNodes(node.Nodes(x))
Else
'leaf
ds = clsRef.oclsCompany.GetCompStandardList(0, node.Nodes(x).Value)
If ds.Tables.Count > 0 Then
For i = 0 To ds.Tables(0).Rows.Count - 1
cNode = New RadTreeNode
cNode.Value = ds.Tables(0).Rows(i)(2)
cNode.Text = ds.Tables(0).Rows(i)(1)
node.Nodes(x).Nodes.Add(cNode)
If Trim(cNode.Text.ToLower) = "ambChild" Then
Dim dscustcomp As New DataSet
dscustcomp = clsRef.oclsCompany.GetCompStandardListItems(0, cNode.Value, sProdCode)
Dim AMBNode = New RadTreeNode(""ambChild" ", "ambChildGroupsNode")
AMBNode.Selected = TreeNodeSelectAction.Expand
Dim AMBLeafNode = New RadTreeNode
**For Each dr In dscustcomp.Tables(0).Rows
AMBLeafNode = New RadTreeNode(dr.Item("Display"), dr.Item("ID"))
AMBNode.Nodes.Add(AMBLeafNode)
Next**
node.Nodes(x).Nodes.Add(AMBNode)
End If
If node.Nodes(x).Selected <> TreeNodeSelectAction.Expand Then
node.Nodes(x).Selected = TreeNodeSelectAction.Expand
End If
Next
End If
End If
Next
'Finally
ds.Dispose()
ds = Nothing
cNode = Nothing
'End Try
End Sub
Nilesh ShahPosted May 29, 2017, 11:13 AM
shailaja.bhatnagarPosted May 29, 2017, 10:42 AM
Do you mean about following loop
If Trim(cNode.Text.ToLower) = "ambChild" Then
Dim dscustcomp As New DataSet
dscustcomp = clsRef.oclsCompany.GetCompStandardListItems(0, cNode.Value, sProdCode)
Dim AMBNode = New RadTreeNode(""ambChild" ", "ambChildGroupsNode")
AMBNode.Selected = TreeNodeSelectAction.Expand
Dim AMBLeafNode = New RadTreeNode
**For Each dr In dscustcomp.Tables(0).Rows
AMBLeafNode = New RadTreeNode(dr.Item("Display"), dr.Item("ID"))
AMBNode.Nodes.Add(AMBLeafNode)
Next**
node.Nodes(x).Nodes.Add(AMBNode)
End If
Actually I want to check if childnode text is "ambChild" then I want to populate node using the value of the node in the background I am taking the value of the node and running a select query which populates the dataset and then I bind childenode with the dataset data. If I get rid of for loop how should I achieve this scenario? Please help
Nilesh ShahPosted May 27, 2017, 12:52 PM
shailaja.bhatnagarPosted May 27, 2017, 10:04 AM
Nilesh ShahPosted May 26, 2017, 1:39 PM