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

$find problem inside a splitter

2 Answers 32 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
SeRiAlKiL
Top achievements
Rank 1
SeRiAlKiL asked on 09 Sep 2008, 12:48 PM
Hello,

I have encountered a problem, trying to expand a node of my treeview

I have tried in two situations

The first one, a simple "test.aspx" page with a treeview, his script manager and an onload function:

function my_onload_expand() {  
  var m_treeview = $find("<%= TreeView1.ClientID %>");  
 
  var node = m_treeview.findNodeByText("Root");  
 
  node.expand();  

And this is perfectly working

If i place the same page inside a splitter, everything stops working, and m_treeview is null

The body of my default.aspx with the splitter is the following
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">  
    </telerik:RadScriptManager> 
        <telerik:radsplitter id="RadSplitter1" runat="server" height="100%" width="100%" Orientation="Horizontal" Skin="Default2006">  
            <telerik:radpane id="panel_header" runat="server" Height="68" ContentUrl="header.aspx" MaxHeight="68" MinHeight="68"></telerik:radpane> 
            <telerik:radsplitbar id="RadSplitbar1" runat="server" CollapseMode="Forward" /> 
            <telerik:radpane id="contentPane" runat="server" Scrolling="None">  
                <telerik:radsplitter id="RadSplitter2" runat="server" height="100%" width="100%" Skin="Default2006">  
                    <telerik:radpane id="panel_menu" runat="server" width="250" ContentUrl="test.aspx"></telerik:radpane> 
                    <telerik:radsplitbar id="RadSplitbar2" runat="server" CollapseMode="Forward" /> 
                    <telerik:radpane id="panel_list" runat="server" ContentUrl="list.aspx"></telerik:radpane> 
                </telerik:radsplitter> 
            </telerik:radpane> 
        </telerik:radsplitter> 

Am i doing something wrong?

2 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 10 Sep 2008, 08:34 AM
Hello,

I tested your code and it worked without a problem. Please check the attached sample project for a reference. What is different in your case?

Greetings,
Yana
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
SeRiAlKiL
Top achievements
Rank 1
answered on 10 Sep 2008, 09:17 AM
Thank you, your code solved my problem

There was one main difference between mine and yours

I was calling "my_onload_expand()" in the <body onload=""> tag

Now I switched to the "OnClientLoad" event of the treeview and it's working

By the way i am curious why using the "body onload" method works with the simple page and not inside a radsplitter

Just to have a look, try to remove the onclientload from your project and move the funcion in the body onload

Thank again for your help
Tags
TreeView
Asked by
SeRiAlKiL
Top achievements
Rank 1
Answers by
Yana
Telerik team
SeRiAlKiL
Top achievements
Rank 1
Share this question
or