Resizing Splitter and Pane when using ContentURL

2 posts, 0 answers
  1. Greg Barretta
    Greg Barretta avatar
    10 posts
    Member since:
    Jan 2010

    Posted 14 Sep 2010 Link to this post

    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>
  2. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 17 Sep 2010 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top