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

Get selected node with javascript

2 Answers 611 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
archimede
Top achievements
Rank 1
archimede asked on 07 Oct 2010, 01:38 PM
Hi,

I create a TreeView  with this code:

 

 

<

 

telerik:RadTreeView ID="rtvLineeBeni" Runat="server" OnNodeExpand="RTV_NodeExpand"

 

Font-Names="Arial" Font-Size="12pt" Font-Strikeout="False" Skin="WebBlue"

 

BorderColor="Gray" Height="390px" Width="748px" AllowNodeEditing="true"

 

OnClientContextMenuItemClicking="onClientContextMenuItemClicking"

 

onnodeedit="rtvLineeBeni_NodeEdit" >
<Nodes>  

 

 

 

 

 

<telerik:RadTreeNode Value="1" ImageUrl="~/Images/ImagesTree/Reparto.png"

 

AllowEdit="false" Text="Reparto" Expanded="true" ContextMenuID="MainContextMenuInsert" >  

 

 

 

 

</telerik:RadTreeNode>

 

</Nodes>

 

</telerik:RadTreeView>

 

Then i populate it ON DEMAND(c# code)

How can i get the selected node with javascript ?
I try this:

 

 

 

 

var oId = document.getElementById('<%=rtvLineeBeni.ClientID %>').value

var oId = document.getElementById('<%=rtvLineeBeni.ClientID %>_SelectedNode').value

but it tells me that it's Undefined ...

Thanks !

 

 

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 08 Oct 2010, 05:13 AM
Hello,

You need to use $find() method to get the client object of ajax enabled controls.
             var tree = $find("<%= RadTreeView1.ClientID %>");


Now use the get_selectedNode() method to get the selected node. The documentation shows most important client side methods of RadTreeview.
RadTreeView



-Shinu.
0
archimede
Top achievements
Rank 1
answered on 11 Oct 2010, 12:29 PM
Thak you It helps me a lot. !!
Tags
General Discussions
Asked by
archimede
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
archimede
Top achievements
Rank 1
Share this question
or