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

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

2 Answers 143 Views
ToolBar
This is a migrated thread and some comments may be shown as answers.
Fred
Top achievements
Rank 1
Fred asked on 20 Oct 2008, 07:38 PM
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 Answers, 1 is accepted

Sort by
0
Fred
Top achievements
Rank 1
answered on 21 Oct 2008, 06:14 AM
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.
0
Tervel
Telerik team
answered on 21 Oct 2008, 08:21 AM
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.
Tags
ToolBar
Asked by
Fred
Top achievements
Rank 1
Answers by
Fred
Top achievements
Rank 1
Tervel
Telerik team
Share this question
or