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

RadWindow ClientClose event failing

2 Answers 54 Views
Window
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 29 Sep 2010, 02:30 PM
Hi,

(Related to previous post, but information there not needed for this query)
I have a form with a RadWindow that pops up on Submit.  All the code within the RadWindow performs properly, but I need it to refresh the page behind on close.  I have this code:

RadWindowManager1.OnClientClose = "FuncName";
which generates this in the client:
in the Sys.Application.add_init(function() {
$create(Telerik.Web.UI.RadWindowManager, [stuff snipped here] {"close":FuncName} [more stuff]
so does appear to be doing what it should within the RadWindow

However, on closing my RadWindow, FuncName is not called at all (tested with alerts and debugger calls).
Any idea why?

(Previous problem was caused by the FuncName function not being in scope at the time of the $create call, this is fixed now, so can't see any reason this should be failing)

Richard.

2 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 30 Sep 2010, 07:21 AM
Hi Richard,

If a FuncName() JavaScript function exists in the page where the RadWindowManager is, it should be called when a RadWinow (created via that same RadWindowManager) is closed.

A problem like the one you describe, can occur if you have more than 1 RadWindowManager on the page. In such case, you need to take into consideration the following:

   1. All RadWindowManager's functions (radopen, radalert, radconfirm, radprompt, GetRadWindowManager, etc) are always using the first rendered RadWindowManager on the page.
   2. Every RadWindowManager "knows" only the RadWindows that are declared in its Windows collection.

This means that if you have a RadWindow2 declared in RadWindowManager2, and you use something like radopen(myUrl, "RadWindow2");, radopen will use RadWindowManager1 and will open a new RadWindow with the settings taken from RadWindowManager1. To avoid that problem, when you have multiple managers on a page, you need to get a reference to the correct RadWindowManager first and then call its methods.
e.g.
var manager = $find("<%= RadWindowManager2.ClientID %>");
manager.open(myUrl, "RadWindow2");


I hope this helps. If you still experience problems, please open a support ticket and send a sample project where the behavior can be reproduced. This blog post can help you isolate the problem.

All the best,
Georgi Tunev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Richard
Top achievements
Rank 1
answered on 30 Sep 2010, 10:40 AM
Thanks for the reply.

There is indeed a FuncName() function on the page, FuncName(argument) in fact in order to fit the format of the call from the event.
If there isn't, you get a JS error on pageload of the containing page, when it tries to register the event.

I found the second RadWindowManager (hiding on the Master Page) I got rid of it, and now it's happy, thank you.

(well, when I say happy, the RadAjaxManager is now failing, but hey, a new thing for me to investigate :) )
Tags
Window
Asked by
Richard
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Richard
Top achievements
Rank 1
Share this question
or