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

Unable to obtain return value...

1 Answer 136 Views
Window
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 03 Oct 2007, 02:01 AM

I am stumped.   Chances are that this will be something simple, but I am unable to obtain the value returned by the RadWindow.Close method in my close event handler.   The eventhandler is being fired, but the value (as verified in the VS 2005 debugger) is showing as "{...}" without an expander to see detail (new to javascript debugging, so I am not really sure what that means!).

Here is the code in the popup window...

    <script>  
        /* This function needed to get reference to RadWindow*/ 
        function GetRadWindow()  
        {  
            var oWindow = null;  
            if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog  
            else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;//IE (and Moz az well)  
                          
            return oWindow;  
        }  
    </script>  
 
//If the user clicks OK then this code is injected into the page via a literal control.  
<script Language=""javascript"">GetRadWindow().close('OK');</script>"  
 
//If the user clicks Cancel then this code is injected into the page via a literal control.  
<script Language=""javascript"">GetRadWindow().close('Cancel');</script>"  
 

Here is the window control defintion...

<telerik:RadWindow ID="rwAddNewContact" runat="server" Modal="true" NavigateUrl="~/ProtectedPages/Popups/NewContact.aspx" OpenerElementID="<%# btnAddNewContact.ClientID %>" VisibleStatusbar="false" VisibleTitlebar="true" Title="Add New Contact" OnClientClose="OnNewContactClose" Height="250" Width="730" OffsetElementID="PopupAnchor" ReloadOnShow="true"></telerik:RadWindow> 
 



Here is the javascript in the parent...

<script type="text/javascript">function OnNewContactClose(radWindow, returnValue)  
    {  
        if (returnValue == "OK")   
            __doPostBack('_ctl0:cphOne:ctrlContactList:btnHiddenPostbackButton','')  
    }  
</script>  
 
 

Again, almost everything is working fine - the popup is displaying, posting its data, closing, and firing the event handler on the main form.   If I remove the IF test, the main page posts back appropriately.

Does anyone have any suggestions?

Thanks!  


1 Answer, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 05 Oct 2007, 12:38 PM
Hello Paul,

I've just answered your support ticket on the same subject. For convenience I am pasting my reply below:



ReturnValueFromADialog.zip

Hello Paul,

You can read the argument in the ClientCallBackFunction, not in OnClientClose. For convenience I've attached to this thread a small sample that shows the approach by using your slightly modified code.




Kind regards,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Window
Asked by
Mike
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Share this question
or