i am using tree view control and a treeview in combo. both are populated with same source containing same data. i want to add a node in both of them by clicking on button. All is going well and code returns no error but newly added node is shown in one tree not both of them depending on my code order. i.e if i try to ad node in treeview in the last then treeview show it but node is not shown in treeview in combo. if i place my code to add treeview in combo in the last then it is shown in treeview in combo but not in simple treeview control. i can not find out the roblem.
Here is my code to add node
| //---Add Node in tree view |
| RadTreeNode node = new RadTreeNode(); |
| RadTreeNode pNode; |
| node.Text = txtGroupAccTitle.Text; |
| node.Value = txtGroupAccNo.Text; |
| ////---Add in TreeView in combo |
| RadTreeView tvwCmbAcc = (RadTreeView)cmbParentAcc.Items[0].FindControl("tvwCmbAcc"); |
| //----Note:Code returns no error but node is not shown in Combo if this code is placed after next block it shows node in combo but not in left side tree. find its reason |
| pNode = tvwCmbAcc.FindNodeByValue(cmbParentAcc.SelectedValue.ToString()); |
| if (pNode != null) |
| { |
| //pNode.Selected = true; |
| pNode.Nodes.Add(node); |
| //pNode.Expanded = true; |
| } |
| else |
| { |
| tvwCmbAcc.Nodes.Add(node); |
| } |
| pNode = null; |
| //------------------------------------------ |
| pNode = tvwGrpAccounts.FindNodeByValue(cmbParentAcc.SelectedValue.ToString()); |
| if (pNode != null) |
| { |
| pNode.Selected = true; |
| pNode.Nodes.Add(node); |
| pNode.Expanded = true; |
| } |
| else |
| { |
| tvwGrpAccounts.Nodes.Add(node); |
| } |