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

Force close of RadConfirm

1 Answer 128 Views
Window
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 11 Apr 2012, 08:52 PM
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.

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 12 Apr 2012, 03:39 PM
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.
Tags
Window
Asked by
David
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or