Unable to obtain return value...

2 posts, 0 answers
  1. Paul
    Paul avatar
    6 posts
    Member since:
    Sep 2007

    Posted 02 Oct 2007 Link to this post

    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!  


  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 05 Oct 2007 Link to this post

    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
Back to Top