Force close of RadConfirm

2 posts, 0 answers
  1. David
    David avatar
    1 posts
    Member since:
    Apr 2012

    Posted 11 Apr 2012 Link to this post

    We have a timer event that asks to extend the session using a radconfirm dialog. However, it's possible that some other event may have caused a radconfirm to be currently displayed. We've had difficulty getting the two to not overlap (e.g. the title bar message gets changed for the wrong one, content gets mixed). So, the approach we are currently trying to pursue is to force a close of the previously displayed dialog before displaying the next one.

    It would be nice if radconfirm returned a handle to the dialog then all we would need to do is:
    var dlg=radconfirm(...);
    ....
    dlg.close();

    But, no such luck. Is there some jScript selector we can use to get the dialog?

    More detail:
    The basic html layout we are using is:
    <ConfirmTemplate>
    	<div id="dlg1" style="display:none">
    		Dialog content
    	</div>
    	<div id="dlg2" style="display:none">
    		Dialog content
    	</div>
    </
    ConfirmTemplate>

    Where just before the call to radconfirm we set the display to the appropriate dialog.
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    5807 posts

    Posted 12 Apr 2012 Link to this post

    Hi David,

    Actually all three methods (radalert(), radconfirm() and radprompt()) return a reference to the dialog they just opened and you can use the RadWindow's client-side API with it to apply needed modifications or to close it. This is explained in the following help article: http://www.telerik.com/help/aspnet-ajax/window-dialogs-confirm.html. This means that when you open one you can store the reference in a global JS variable and check for it before showing another. You can reset this variable back to null in the callback functions of the dialogs to make sure things are correct.

    When a new RadConfirm is opened it will be on top of the previous one, yet I see you have heavily modified the template and I am not sure what else might have been changed (e.g. if you modify the z-indexes via CSS or JavaScript this can break the manager's logic). This means that usually there will be no problem with displaying on top of the other, so closing the previous one would not be necessary.

    I can also suggest the RadNotification control as I see you are using quite a simple template so just settings some text in it may  suffice in your case.


    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.
Back to Top