Rad Window Reload Event

2 posts, 0 answers
  1. Arindam
    Arindam avatar
    28 posts
    Member since:
    Mar 2009

    Posted 02 Apr 2009 Link to this post

    Hi -

    I am dragging a node from RadTreeView and dropping in a div. I am having 2 problems:-

    1. The RadWindow is loading 2 times. The RadWindowManager Code snippet is below :-
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" VisibleOnPageLoad="false"
                        VisibleTitlebar="true" VisibleStatusbar="false"
                        ReloadOnShow ="true" ShowContentDuringLoad="true" RestrictionZoneID="myDiv" Skin="Telerik"
                        OnClientCommand="oCCWindow">
     </telerik:RadWindowManager>

    2. Whenever I am clicking the reload event of RadWindow, I am getting all alerts, but I am not able to redirect it to www.google.com on reload. The openDashboards function is getting called when I am dragging a node from RadTreeView i.e. OnClientNodeDragging and whenever I am clicking the reload button of RadWindow, function oCCWindow is called.

    Please find below the code snippet :-




    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function oCCWindow(sender, eventArgs)  
            {  
                if (eventArgs.get_commandName() == "Reload")
                {
                    var oManager = GetRadWindowManager();
                    alert(oManager);
                    var oWnd = oManager.GetWindowByName(sender.get_id());
                    alert(oWnd);
                    oWnd.SetUrl('http://www.google.com');
                    oWnd.Show();
                }
                //window.alert("1");
                //alert("Window with ID " + sender.get_id() + ". Command is " + eventArgs.get_commandName());   
            }
             
            function openDashboards(sender, eventArgs)
            {
                    //get the clicked node
                    var title = eventArgs.get_node(sender, eventArgs).get_text();
                    var link = eventArgs.get_node(sender, eventArgs).get_value();
                    var oWnd = radopen(link,null);
                    //oWnd.OnClientCommand = 'oCCWindow';
                    oWnd.set_title(title);
               }
            </script>
        </telerik:RadCodeBlock>

    Please help me where I am going worng.

    Thanks in advance.
    Happy Coding!!!
    Arindam
  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 06 Apr 2009 Link to this post

    Hello Arindam,

    You need to cancel the Reload command first. Note that the sender argument in the oCCWindow function is actually the RadWindow object itself so there is no need to get a reference to that RadWindow again:

    function oCCWindow(sender, eventArgs)   
    {   
        if (eventArgs.get_commandName() == "Reload"
        { 
            //cancel the reload command 
            eventArgs.set_cancel(true); 
             
            // var oManager = GetRadWindowManager(); 
            // alert(oManager); 
            // var oWnd = oManager.GetWindowByName(sender.get_id()); 
            // alert(oWnd); 
            // oWnd.SetUrl('http://www.google.com'); 
            // oWnd.Show(); 
     
            sender.setUrl('http://www.google.com');  
        } 
        //window.alert("1"); 
        //alert("Window with ID " + sender.get_id() + ". Command is " + eventArgs.get_commandName());    


    As for the first problem, I suggest to upgrade to SP1 that was released on 2nd of April. If you still experience problems after that, please open a support ticket and send us a sample project (make sure it can be run locally) where the problem could be reproduced.

    Kind regards,
    Georgi Tunev
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Back to Top