This is a migrated thread and some comments may be shown as answers.
radwindow onclientclose question
1 Answer 33 Views
This is a migrated thread and some comments may be shown as answers.
Steven
Top achievements
Rank 1
Steven asked on 21 Jan 2012, 12:07 AM

Kinda new to telerik.

I have a page with a windowmanager, radwindow, and a customcontrol on it.

the customcontrol uses javascript to open the control on the parent page like so

function UseRadWindowOnParentPage(DialogURL,RadWindowID, Width, Height, Title, argument) {
    var oManager = GetRadWindowManager();
    var oWnd = oManager.GetWindowByName(RadWindowID);
    oWnd.Show();
    oWnd.SetSize(Width, Height);
    oWnd.SetUrl(DialogURL);
    oWnd.SetTitle(Title);
    oWnd.Center();
    oWnd.argument = argument;
 
    oWnd.OnClientClose = function () {
        alert('client close');
    }
}

 

 

oWnd.OnClientClose never fires.
Any idea whats going on?

If i set the OnClientClose property in the radwindow control it works. The radwindow is used several times and not everything is supposed to have a onclientclose event.

I know I could add a radwindow for every popup I need but I got it this far and would prefer to reuse 1 radwindow rather than adding 6 radwindows where the only real difference is the OnClientClose

http://www.telerik.com/help/aspnet/window/radwindowobjectclientside.html so far, most everything I have tried from this link works.

thanks

 

 

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 23 Jan 2012, 04:41 PM
Hello Steven,

Let me start with pointing you to the current documentation for the RadControls for ASP.NET AJAX, as the link you pasted if from the old, "Classic" suite's documentation which is no longer supported. Here begins the current version: http://www.telerik.com/help/aspnet-ajax/introduction.html and here the RadWindow's: http://www.telerik.com/help/aspnet-ajax/window-overview.html.

Now, to your questions - attaching event handlers via JavaScritp is done via an explicit method, which is described here: http://www.telerik.com/help/aspnet-ajax/window-programming-setting-client-events-using-javascript.html. Please keep in mind that if you reuse the same window adding handler more than once will naturally result in it being called multiple times. What you can do to avoid this is to remove the handler in the OnClientClose event handler itself.

 An alternative solution is to declare two different RadWindows - one with the hander and one without it (or any other different configurations you may need) and use the one you need. You may find useful this article on the different ways to open a RadWindow: http://www.telerik.com/help/aspnet-ajax/window-programming-opening.html.

Yet another option is to set the DestroyOnClose property of the manager to true so that each RadWIndow is disposed when it is closed. This will make sure you create a new instance each time and it will have only one handler attached (you can attach it only if need be, a simple if statement).

I would also advise that you examine the current client-side API of the RadWindow here: http://www.telerik.com/help/aspnet-ajax/window-programming-radwindow-methods.html.


Kind regards,
Marin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Asked by
Steven
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or