Client-Side Events et. al.

4 posts, 0 answers
  1. Shaun Peet
    Shaun Peet avatar
    571 posts
    Member since:
    Aug 2004

    Posted 30 May 2007 Link to this post

    There seems to be more and more differenced between the old splitter and the new one which is really causing some serious snags.

    For example, if you had this in the root of the application:

    /Master.master (with a two-pane splitter, one contains a ContentPlaceHolder,a nd the other has a ContentUrl of "Home.aspx")
    /Default.aspx (using the master page)
    /Home.aspx

    And then also had this:

    /SubFolder/Default.aspx (using the master page)
    /SubFolder/Home.aspx

    The old splitter would load the Home.aspx file relative to the location of the Default.aspx, so when you moved from one folder to another, so too did the "Home.aspx" file.

    The new splitter always loads the "Home.aspx" file located in the root directory.  Which brings me to the Client-Side Events problems I'm having.

    Since with the new splitter I now have to tell it what page to load in the external content pane when I change folders, I'm adding a response script to the master page's RadAjaxManager on the page load to load the desired page.  The response script is simply "LoadContent('Home.aspx');", which calls the following function located on the master page:

    function LoadContent(url)  
    {  
        var splitter = $find("<%= RadSplitter1.ClientID %>");  
        var pane = splitter.GetPaneById("RadPaneContent");  
        if (!pane) return;  
        pane.SetContentUrl(url);  
    }  
     

    This worked great with the old splitter, but with the new one, it finds the splitter ok, but GetPaneById fails with "object does not support this property or method".  If I do splitter.get_Height() it works fine so I know that it is indeed finding the splitter object.

    The documentation and the online examples both say that GetPaneById should work, which is really really frustrating.

    Any help out there is sincerely appreciated.


  2. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 31 May 2007 Link to this post

    Hi Shaun,
    Straight to your questions:
    1. I believe the behavior you observe with the new RadSplitter is actually the correct behavior. Do you believe that the behavior of the old RadSplitter is more intuitive?
    2. We did notice that we have failed updated the Help topics of the RadSpitter to inform our customers that we have changed the names of some public methods of the RadSplitter control in order to follow the naming convention we have introduced in the Prometheus controls. We will update the topics as soon as possible. You should change GetPaneById to getPaneById and you should not get the error you describe.
    Best wishes,
    Tsvetie
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Shaun Peet
    Shaun Peet avatar
    571 posts
    Member since:
    Aug 2004

    Posted 31 May 2007 Link to this post

    It's hard to say what is more intuitive.  The old behavior required that you had a "default file" of the exaxt same name in each directory.  For my purposes, that actually had some benefits.  What I'm finding now that works best is using a "loading.htm" file as the default ContentUrl which loads really quickly, and then calling script to re-set the ContentUrl to the correct page.  The only hiccup with that is the fact that you need to delay the loading of the second page because the splitter needs a little bit of time to be generated.

    One thing that I did finally figure out (other than the lower case get/set commands) was that the ClientID of the RadPane when used in a MasterPage has a nice little "ctl00_" prefixed to it, so the getPaneById doesn't find the pane without the prefix.  Here's the ASPX code:

    <telerik:RadSplitter ID="rsCP" runat="server" Orientation="horizontal" FullScreenMode="true">  
        <telerik:RadPane ID="rpTop" runat="server" Height="68px" Scrolling="none">  
            <div id="divPageList">  
                <asp:ContentPlaceHolder ID="cPages" runat="server">  
                </asp:ContentPlaceHolder> 
            </div> 
        </telerik:RadPane> 
        <telerik:RadPane ID="rpContent" runat="server" ContentUrl="htmLoading.htm">  
        </telerik:RadPane> 
    </telerik:RadSplitter> 
     

    Here's the Javascript on the MasterPage:

    function DelayedLoad(url, time)  
    {  
        var func = "LoadContent('" + url + "')";  
        setTimeout(func, time);  
    }  
    function LoadContent(url)  
    {  
        var splitter = $find("<%= rsCP.ClientID %>");  
        if (!splitter) return;  
        var pane = splitter.getPaneById('ctl00_rpContent');  
        if (!pane) return;  
        pane.set_ContentUrl(url);  

    Then in the server-side code for any of the Default.aspx pages that use the master page:

    Public Sub LoadContent(ByVal mp As MasterPage, ByVal ramName As StringByVal url As StringByVal delay As Integer)  
        Dim a As Telerik.Web.UI.RadAjaxManager = mp.FindControl(ramName)  
        a.ResponseScripts.Add("DelayedLoad('" & url & "'," & delay & ")")  
    End Sub 
     
    Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load  
        If Not IsPostBack Then 
            LoadContent(Master, "ramCP""Dashboard.aspx", 1000)  
        End If 
    End Sub 
     

    I believe that I've gotten it working somewhat slickly now.  The next step in my process is to get "modal" windows popping up and updating the content page.  Once I get that, I'll be submitting it to the code library for sure!
  5. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 01 Jun 2007 Link to this post

    Hi Shaun,
    That is great. I just have one suggestion - in order to get the ClientID of the RadPane, you can use the same approach you use to get the ClientID of the RadSplitter:

     var pane = splitter.getPaneById("<%= rpContent.ClientID %>");

    Sincerely yours,
    Tsvetie
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top