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

ClientNodeExpanded Event with NodeTemplate

2 Answers 85 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
hbanerjee
Top achievements
Rank 1
hbanerjee asked on 18 Sep 2008, 08:11 AM
I have a RadTree inside an UpdatePanel and a Javascript function for ClientNodeExpanded event. I have everything inside the RadTree in a NodeTemplate. I am calling eventArgs.get_node() and then do a findControl but I am getting a javascript error saying "Object does not support his property or method" . Can you please tell me what I am doing wrong?
Below is my code snippet.

function ClientNodeExpanded(sender, eventArgs)
{
    var node = eventArgs.get_node();
    alert(node); //so far so good. I am getting [object object]  
    var hdNodeExpandCtrl = node.findControl("hdNodeExpand");
}

<asp

:UpdatePanel ID="RadTreeUpdatePanel" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
<ContentTemplate>
<telerik:RadTreeView ID="RadTreeView1" Width="100%" runat="server" ShowLineImages="False"
OnClientNodeExpanded="ClientNodeExpanded" Skin="Web20"OnClientNodeCollapsed="ClientNodeCollapsed" >
<NodeTemplate>
<div id="nodeEle" runat="server">
            <input type="hidden" id="hdNodeExpand" value="0" />
</div>
</NodeTemplate>
</telerik:RadTreeView>
</ContentTemplate>
</asp:UpdatePanel>

 

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 18 Sep 2008, 11:52 AM
Hi Friend,

This is the code which I tried on my end . Give a try with the below given code and see if it helps.

JS:
 <script  language="javascript" type="text/javascript"
     function OnClientNodeExpanded(sender, eventArgs) 
     { 
       var node = eventArgs.get_node(); 
       var contentElement = node.get_contentElement();  
        var div = contentElement.getElementsByTagName("div"); 
        var span=div[1].getElementsByTagName("input"); 
      
       alert(span[0].value); 
     } 
<script/> 


Cheers
Shinu.
0
hbanerjee
Top achievements
Rank 1
answered on 18 Sep 2008, 12:29 PM
Chinu
        Thanks for your quick reply. I have a lot of <div>s tables etc. in that node template. I have couple of hidden fields in there which I want to change the value when I expand or collapse a node. Then I want to keep that node collapsed and expanded when I come back from another RadWindow that I am firing. The node template gives me a lot of flexibility but I am really struggling with 2 things. One is I can't do a findControl Client Side and Server Side does not fire NodeExpand Event or Collapse Event when I have templated nodes like this. I could have grabbded those hidden variables if on server side those events were firing.

The second issue (completely separate from the first one) is that the RadTree main css file (no matter what I skin I use)  has something in it that is causing FireFox and Opera not to wrap a HTML block that has no <br> inside that tree ignoring the boundaries <td></td> in that node template. IE 6 and 7 is wrapping it fine. FireFox and Opera is not wrapping anything. So if you can please help me with these 2 issues I will be extremely greatful.

Thanks
Himadri
Tags
TreeView
Asked by
hbanerjee
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
hbanerjee
Top achievements
Rank 1
Share this question
or