Having trouble. Using Toolbar to open Dialog RadWindow, and then postback and refresh parent window.

3 posts, 0 answers
  1. Fred
    Fred avatar
    86 posts
    Member since:
    Sep 2008

    Posted 20 Oct 2008 Link to this post

    Solved


    Not sure why I'm having so much trouble.

    I have  radToolbar, which I've follow the steps to create my own custom button that calls the radwindow of my choice. This window loads up a dialog window with a textbox and an OK, cancel button.

    On "Ok" I want to perform an operation and then close the dialog window and reload the parent.
    On cancel I just want to close the window.


    I can get the window to show, but that's it.  I can't get the window to close, I think the parent is refreshing just haven't been able to confirm yet.

    I can't figure out how to
    a) send the dialog window some variables, like userid
    b) get the dialog to run code-behind then close
    c) refresh parent window


    On my dialog page I have this script..

    <script type="text/javascript" language="javascript"
            function GetRadWindow() 
            { 
                var oWindow = null
                if (window.radWindow) 
                    oWindow = window.radWindow; 
                else if (window.frameElement.radWindow) 
                    oWindow = window.frameElement.radWindow; 
                return oWindow; 
            }   
             
             
            function cancelWindow() 
            { 
                var oWindow = GetRadWindow(); 
                oWindow.argument = null
                oWindow.close(); 
            } 
         
            function closeClientCallBack() 
            { 
                var currentWindow = GetRadWindow(); 
                var Input = document.getElementById("ddlDocument"); 
                currentWindow.argument = null
                currentWindow.close(Input.value); 
                RefreshParentPage(); 
            } 
             
            function clientClose() 
            { 
                var currentWindow = GetRadWindow(); 
                var Input = document.getElementById("ddlDocument"); 
                currentWindow.argument = Input.innerText; 
                currentWindow.close(); 
                RefreshParentPage(); 
            }  
         
            function RefreshParentPage() 
            { 
                GetRadWindow().BrowserWindow.location.href = GetRadWindow().BrowserWindow.location.href; 
            } 
     
        </script> 

    and then the buttons:

    <asp:Button  
                ID="btnOpenDocument"  
                runat="server"  
                OnClientClick="closeClientCallBack();return false;" 
                AlternateText="Open Document"  
                Text="Open"
            </asp:Button> 
            <asp:Button  
                ID="btnCancelOpenDocument" 
                runat="server" 
                OnClientClick="cancelWindow();return false;" 
                Text="Cancel"
            </asp:Button> 



  2. Fred
    Fred avatar
    86 posts
    Member since:
    Sep 2008

    Posted 21 Oct 2008 Link to this post

    Ok I got it working, script was referencing an invalid control object causing it to fail.  Now just have to figure out how to send the radwindow values.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 21 Oct 2008 Link to this post

    Hello Fred,

    It depends whether you try to send values through the server or through the client {with script].

    Please examine the following two demos:
    http://demos.telerik.com/aspnet/prometheus/Window/Examples/CommunicationBetweenRadWindows/DefaultCS.aspx






    http://demos.telerik.com/aspnet/prometheus/Window/Examples/UsingURLForServerArguments/DefaultCS.aspx


    Best wishes,
    Tervel
    the Telerik team

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