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

RadWindow.OnClientClose event fires only once

5 Answers 173 Views
Window
This is a migrated thread and some comments may be shown as answers.
prens
Top achievements
Rank 1
prens asked on 24 Nov 2011, 11:38 AM
We have a WebSite and it uses Telerik and AjaxControlToolikit components both. But we faced a brand new problem.

Problem: If there is an "AjaxControlToolkit.dll" in your Bin folder. RadWindow.OnClientClose event fires only once time.

To reproduce this error, you can use "\Live Demos" samples shipped with Telerik.

Steps to reproduce:
Set startup page to "\Live Demos\Window\Examples\Default\DefaultVB.aspx" and,
add "alert(oWnd);" after the "function OnClientClose(oWnd) {".

After the changes code must be shown like this:
function OnClientClose(oWnd) {
    alert(oWnd); //newly added line
    //Get the title of the active RadWindow
    var title = oWnd.get_title();
    .....
    .....



Then run the sample.

Press "Open" button for three times to open three "bing.com" windows. And try to close one by one opened windows.
So far, there is no problem. Every click to "X" button, will fire "OnClientClose" event.

Now; add the "AjaxControlToolkit.dll" to the "Live Demos\Bin" folder. And run same example again.
When you close the first Bing Window you'll see an alert. But when you try to close second ( or third, or more) Bing window "OnClientClose" event will be not fired.




Information:
Visual Studio 2010 - .NET 4.0 Web Site Project
Telerik.Web.UI : 2011.3.1115.40
AjaxControlToolkit.dll: 4.1.51116.0 (latest)

5 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 25 Nov 2011, 04:48 PM
Hello Prens,

The AjaxControlToolkit assembly changes some of the MS AJAX scripts, which results in some incorrect behavior in other code that relies on these scripts. Our controls, being built on top of the MS AJAX framework heavily use them, so this change affects them. We have done what is possible to alleviate the issue yet this is mostly out of our control.

I also tested the scenario and on my end the event is fired correctly if you remove the DestroyOnClose property of the RadWindowManager/RadWindows, so you can give it a try and see if this helps in your case.


Greetings,
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
0
prens
Top achievements
Rank 1
answered on 25 Nov 2011, 05:20 PM
Hello Marin,

Thanks for your prompt reply. When we remove DestroyOnClose property event fires,  however this time the window content is not destroyed but hidden. Next time the window is recalled, it continues from where it was hid. But we want a clean state of the window each time, that's why we need to destroy the content.
Any suggestions or workarounds will be highly appreciated.

(We didn't have this issue on AjaxToolkit 3.5, it appeared after we moved to 4.0+)
0
prens
Top achievements
Rank 1
answered on 25 Nov 2011, 05:21 PM
Hello Marin,

Thanks for your prompt reply. When we remove DestroyOnClose property event fires,  however this time the window content is not destroyed but hidden. Next time the window is recalled, it continues from where it was hid. But we want a clean state of the window each time, that's why we need to destroy the content.
Any suggestions or workarounds will be highly appreciated.

(We didn't have this issue on AjaxToolkit 3.5, it appeared after we moved to 4.0+)
0
Stuart Hemming
Top achievements
Rank 2
answered on 25 Nov 2011, 05:39 PM
Prens,

You could reset the NavigateUrl for the window in the OnClientClose to something like "about:blank" then set it back to what it should be the next time you show it.

To do this, .setUrl() is your friend.

-- 
Stuart
0
Kevin
Top achievements
Rank 2
answered on 28 Nov 2011, 01:55 PM
You could also set ReloadOnShow="true" to always reload the page when the window is opened.
Tags
Window
Asked by
prens
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
prens
Top achievements
Rank 1
Stuart Hemming
Top achievements
Rank 2
Kevin
Top achievements
Rank 2
Share this question
or