This is a migrated thread and some comments may be shown as answers.

Radtreeview select childnodes.Help!

1 Answer 100 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
bui
Top achievements
Rank 1
bui asked on 02 Aug 2010, 01:01 PM
hi there,
i'm having a trouble in radtreeview, and i'm so confused about it.
i'm using radtreeview to load data from SQL DB, and checkbox involves.
i have three level of employee (it mean i have 3 level of nodes)  and i display all employees on my radtreeview,
i want to click to checkboxes to select employees id, then insert into my DB.
but, when i click to my employees's level 3, ( it mean : this node at 3th level )
i can not refer to parent of this node ( refer to manager of this employee ) to select  value of node.
can you help me to resolve this proplem.
thanks,
ps: best regards.
this is my code :
AspTree.aspx
--

<

 

div class="center" style="width:500px; height:auto; float:left;">

 

 

 

&nbsp;<br />

 

 

<radt:radtreeview id="RadTreeView1" runat="server" CheckBoxes="True"

 

 

OnNodeClick="NodeClick"

 

 

OnNodeCheck="RadTreeView1_NodeCheck" AfterClientCheck="AfterCheck"

 

 

 

></radt:radtreeview>

 

 

<br />

 

 

<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text=" Cp Nht " />

 

 

</div>

 


--
AspTree.aspx.cs
 ----

RadTreeNode

 

parentNode = node.Parent;

 

 

string PNode = parentNode.Value;

 

#region

 

comment

 

 

if (RadTreeView1.Nodes.FindNodeByValue(PNode).Checked)

 

{
    // do something if parent node checked.

}
-----

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 06 Aug 2010, 09:04 AM
Hello,

You should either use ParentNode property or cast node.Parent to RadTreeNode type:

RadTreeNode parentNode = node.ParentNode;
RadTreeNode parentNode = (RadTreeNode) node.Parent;


Kind regards,
Yana
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
TreeView
Asked by
bui
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or