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

Set the Rad splitter height and width on window resize

6 Answers 229 Views
Splitter
This is a migrated thread and some comments may be shown as answers.
Nataraj Vedula
Top achievements
Rank 1
Nataraj Vedula asked on 20 Nov 2008, 05:47 AM

Hi,

I wrote a small script to set the height and width of splitter on window resize. I am getting an script error saying that object doesn't support this property or method. Please help me to set the desired height and width for the splitter. Below is the script.

<script type="text/javascript">   
    window.onresize=resized;  
    function resized()  
    {  
        var splitter = document.getElementById("ctl00_ReportContent_Splitter1").id;  
        splitter.set_height(document.getElementById("ctl00_ReportContent_ReportRow").clientHeight);  
        splitter.set_width(document.getElementById("ctl00_ReportContent_ReportRow").clientWidth);  
    }  
 </script> 

I even tried spliiter.resize(). This also gave JS error. I referred the splitter's ClientSide API from http://www.telerik.com/help/aspnet-ajax/splitter_clientsideradsplitter.html.

Thanks,
Nataraj

6 Answers, 1 is accepted

Sort by
0
Vyrban
Top achievements
Rank 1
answered on 24 Nov 2008, 11:11 AM
HI,

I think, you use the correct methods but in the wrong level of abstraction. As i see in your code:
var splitter = document.getElementById("ctl00_ReportContent_Splitter1").id; 
splitter is not an object, but string! So you can not expect splitter.set_height and splitter.set_width to work.

Regards,
Vyrban.
0
Antony
Top achievements
Rank 1
answered on 18 Mar 2009, 02:33 PM

Hi,

In case anybody else is viewing this thread. Nataraj would have been better off referencing the object like this

var splitter = $find("ctl00_ReportContent_Splitter1"); 

Antony
0
Svetlina Anati
Telerik team
answered on 18 Mar 2009, 03:03 PM
Hi guys,

Actually, Antony is correct and if you have to use the control's API you should reference its client object which should be done by using the $find method. By using the getElementById or $get methods, you reference a HTML element and it does not support the API of the client object.

I also recommend to use block brackets in order to dynamically evaluate the client ID instead of hard-coding it as shown below:

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


Sincerely yours,
Svetlina
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Eric
Top achievements
Rank 1
answered on 24 Mar 2009, 04:18 PM
Hi Svetlina,

I am trying to size a splitter and your answer above should help but my splitter is in a master page and it looks like the "<%=Splitter1.ClientID%>" is not allowed in a master page.

Is there an easy way around this?

Eric
0
Tsvetie
Telerik team
answered on 24 Mar 2009, 05:13 PM
Hello Eric,
You can just wrap your javascript code in a RadCodeBlock. Please refer to our online documentation for information on this control.

Regards,
Tsvetie
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Eric
Top achievements
Rank 1
answered on 25 Mar 2009, 03:39 PM
Thanks
Tags
Splitter
Asked by
Nataraj Vedula
Top achievements
Rank 1
Answers by
Vyrban
Top achievements
Rank 1
Antony
Top achievements
Rank 1
Svetlina Anati
Telerik team
Eric
Top achievements
Rank 1
Tsvetie
Telerik team
Share this question
or