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

Resizing Splitter and Pane when using ContentURL

1 Answer 51 Views
Splitter
This is a migrated thread and some comments may be shown as answers.
Greg Barretta
Top achievements
Rank 1
Greg Barretta asked on 14 Sep 2010, 09:20 PM
I have modified an example I found on the Telerik site to determine content size in order to adjust a pane and splitter to the size of the content. All works in the example when you hard code some content. However if I set the ContentURL of the pane to an external URL, the sizing no longer works. Any ideas?
<%@ Page Title="Home Page" Language="C#" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="FrameTest._Default" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<head id="Head1" runat="server">
    <title>Untitled Page</title>
</head>
<body>
 
    <script type="text/javascript">
        function SplitterLoaded(splitter, arg) {
            var pane = splitter.getPaneById('<%= RadPane2.ClientID %>');
            var height = pane.getContentElement().scrollHeight;
            splitter.set_height(splitter.get_height() - pane.get_height() + height);
            pane.set_height(height);
        }
    </script>
 
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <telerik:RadSplitter ID="RadSplitter1" runat="server" Width="200px" Height="200px"
            OnClientLoaded="SplitterLoaded" Orientation="Horizontal">
               <telerik:RadPane ID="RadPane2" runat="server" ContentUrl="http://google.com" Scrolling="None">
                
            </telerik:RadPane>
        </telerik:RadSplitter>
    </form>
</body>
</html>

1 Answer, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 17 Sep 2010, 02:33 PM
Hi Greg Barretta,

 This functionality is not implemented by design but you can achieve it by javascript means. You need to define the following functions:

- One function in the page which will be loaded in the RadPane and returns the height of the page.
- One function in the main page (which contains the RadSplitter control) which sets the returned by the previous function height to the RadPane object.
- Call the main page's sizing function on RadPane's content page load.

Note, that this can work only for pages in the same domain because of the browsers security - you cannot manipulate and calculate the scrolling of  e.g google page with javascript because if cross domain scripting was allowed, this would lead to hacker attacks.

You can find a sample demo attached.

Best wishes,

Svetlina
the Telerik team

 

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Splitter
Asked by
Greg Barretta
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Share this question
or