RadWindow.OnClientClose event fires only once

6 posts, 0 answers
  1. prens
    prens avatar
    4 posts
    Member since:
    Feb 2007

    Posted 24 Nov 2011 Link to this post

    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)
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3600 posts

    Posted 25 Nov 2011 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. prens
    prens avatar
    4 posts
    Member since:
    Feb 2007

    Posted 25 Nov 2011 Link to this post

    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+)
  5. prens
    prens avatar
    4 posts
    Member since:
    Feb 2007

    Posted 25 Nov 2011 Link to this post

    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+)
  6. Stuart Hemming
    Stuart Hemming avatar
    1622 posts
    Member since:
    Jul 2004

    Posted 25 Nov 2011 Link to this post

    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
  7. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 28 Nov 2011 Link to this post

    You could also set ReloadOnShow="true" to always reload the page when the window is opened.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017