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

Cannot access radsplitter that is nested inside of another radsplitter

1 Answer 66 Views
Splitter
This is a migrated thread and some comments may be shown as answers.
Bruce
Top achievements
Rank 2
Bruce asked on 29 Oct 2008, 08:48 PM

I am trying to access a radsplitter control via client-side scripting.

The radsplitter i am trying to reference is nested inside of another radsplitter/radpane.

Here is an example of how i access the splitter:

var splitter = $find("<%= innerSplitter.ClientID %>");

 

<

telerik:RadSplitter ID="outterSplitter" runat="server" Orientation="horizontal">
<telerik:RadPane ID="pane1" runat="server" >
<telerik:RadSplitter ID="innerSplitter" runat="server" VisibleDuringInit="False">
<telerik:RadPane ID="pane2" runat="server" Scrolling="none"  OnClientResized="afterResize">
left pane of the splitter
</telerik:RadPane>
right pane of the splitter
<telerik:RadSplitBar ID="splitbar1" runat="server" />
<telerik:RadPane ID="pane3" runat="server" OnClientResized="afterResize2"></telerik:RadPane>
</telerik:RadSplitter>
</telerik:RadPane>
<telerik:RadSplitBar ID="splitbar2" runat="server" CollapseMode="None"/>
<telerik:RadPane ID="pane4" runat="server" height="20px" Locked ="true" >
bottom pane of the splitter
</telerik:RadPane>
</
telerik:RadSplitter> 


Everything is named appropriately, etc.


The value of splitter is always null.


 

1 Answer, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 03 Nov 2008, 11:43 AM
Hello Bruce,

I examined your code and it seems to be correct. Possible reasons for the problem can be the following ones:

  1. You get a javascript error before you reference the splitter, e.g in the AfterResize function.
  2. You try to reference the splitter's client object before it is created.

    You should note that in MS ASP.NET AJAX client control objects are created in a manner similar to this:

       .......
       <script type="text/javascript">
       <!--
       Sys.Application.initialize();
       Sys.Application.add_init(function() {
           $create(MS.AJAX.SomeControl, {controlparameters : ''}, null, $get("controlelement"));
       });
       // -->
       </script>
     
    </body>
    </html>

    Here is how the client events are fired in the page life cycle:

    window.onload -> Sys.Application.init -> Sys.Application.load

    You can see that the client object representation of MS AJAX controls are created just as the last code on the page in the Sys.Application.init event, which is raised after the window.onload event. 

    For that reason you can get a reference to RadSplitter no earlier that in the Sys.Application.load event, which is raised after all scripts have been loaded and the objects in the application have been created and initialized.

In case you need further assistance, please open a new support ticket and send me a sample, fully runnable reproduction demo along with detailed reproduction instructions.

Sincerely yours,
Svetlina
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Splitter
Asked by
Bruce
Top achievements
Rank 2
Answers by
Svetlina Anati
Telerik team
Share this question
or