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

[Solved] Questions about OnClientClose

2 Answers 248 Views
Window
This is a migrated thread and some comments may be shown as answers.
Skypy
Top achievements
Rank 1
Skypy asked on 21 Mar 2008, 04:07 PM
Hello,

In http://www.telerik.com/help/aspnet/window/RadWindowObjectClientSide.html :
//Set the OnClientClose dynamically. Useful for RadWindows created on the client.
function OpenWin()
   {
       
var oWnd = radopen("Dialog.aspx", null);
       oWnd.OnClientClose
= function()
           {
               
// Your code here
               alert('Closed');
           }
   }


I tried this code but code inside function() is never called.

In http://www.telerik.com/help/aspnet/window/ClientSideModel.html :
/* Called when a window is being closed. */
                
function OnClientClose(radWindow)
               {
                   
alert (radWindow.Name + " is being closed");
               }

I tried this code but
radWindow.Name contains 'undefined'.

What is the problem with these 2 functions ?
Thanks

2 Answers, 1 is accepted

Sort by
0
Skypy
Top achievements
Rank 1
answered on 21 Mar 2008, 04:30 PM
alert (radWindow.Name + " is being closed");
-> if I use radWindow.GetUrl() I get correct Url so I think I did a mistake with Name set.

Still no clue for the other problem.

----
I noticed a wrong link in Prometheus documentation :
http://www.telerik.com/help/aspnet/window/RadWindowManagerspecificproperties.html

Current link for
ClientCallBackFunction is :
http://www.telerik.com/help/aspnet/window/RadWindow~Telerik.WebControls.RadWindowManager~ClientCallBackFunction.html
and correct link is :
http://www.telerik.com/help/aspnet/window/RadWindow~Telerik.WebControls.RadWindowBase~ClientCallBackFunction.html
0
Accepted
Svetlina Anati
Telerik team
answered on 24 Mar 2008, 12:18 PM
Hi Skypy,

I followed the links and I noticed that they are about RadWindow and you are using RadWindow "Prometheus". Please, note that these two versions of RadWindow have different client-side API and in order to take effect you should use the proper API.

For example, the alternative code of your function:

function OpenWin()  
   {  
       var oWnd = radopen("Dialog.aspx"null);  
       oWnd.OnClientClose = function()  
           {  
               // Your code here  
               alert('Closed');  
           }  
   }  
 

when using RadWindow "Prometheus" should be:

 function OpenWin()     
    {  
      var oWnd = radopen( "Dialog.aspx"null);         
      oWnd.add_Close(OnClientCloseWin);     
    }     
    function OnClientCloseWin()  
    {             
      //Your code here             
      alert('Closed');  
    } 

You can find more information about the RadWindow "Prometheus" in the RadControls "Prometheus" documentation, Controls/RadWindow section -  here.

I also recommend you to check out the following links:

http://www.telerik.com/help/radcontrols/prometheus/?window_MigratingFromClassicToPrometheus.html
http://www.telerik.com/help/radcontrols/prometheus/?window_ProgrammingSettingClientEventsUsingJavascript.html
http://www.telerik.com/DEMOS/ASPNET/Prometheus/Window/Examples/ClientSideEvents/DefaultCS.aspx


Regards,
Svetlina
the Telerik team

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