Is it possible to show multiple modal-dialogs above each other?

It should work like this:

1) User clicks link that opens first modal dialog
2) in first modal dialog, user clicks another link that opens second modal dialog
3) in second modal dialog, user clicks another link that opens third modal dialog
4) ....

NOT: open multiple modal-dialogs with one click!

So it should be possible to some of you, but now I need to know why this doesn't work then:


//When button pressed, this method is executed
ShowPopup(this.Page, "/_layouts/MyPage.aspx", "Account");

public static void ShowPopup(Page page, string url, string title)
       if (page.IsPostBack && !page.ClientScript.IsClientScriptBlockRegistered("ShowMyPopup"))
            page.ClientScript.RegisterClientScriptBlock(page.GetType(), "ShowMyPopup", "ExecuteOrDelayUntilScriptLoaded(function () {ExecuteOrDelayUntilScriptLoaded (openDialog('" + SPContext.Current.Site.Url + url + "', '" + title + "'),'MyJavascriptFile.js')}, 'sp.js');", true);


function openDialog(myUrl, myTitle) {
var options = {
    url: myUrl,
    width: 800,
    height: 600,
    title: myTitle,
    allowMaximize: true,
    showClose: true

So first time it works, second not... Any help?

  • 1
    just to confirm... You mean that the button does not work when pressed inside the second pop-up or that the button does not work if you press it a second time on the same page/level after closing the popup?
    – SPArcheon
    Commented Mar 30, 2012 at 6:45
  • It doesn't work when I press the button in the second pop-up for the FIRST time Commented Mar 30, 2012 at 7:05
  • 1
    Sorry for the late answer. I can confirm what I said in my answer - multiple level of pop-up should work out-of-the-box (I have done them in the past). Looking at your sample, I can suppose that the register instruction is somehow interfering with the IFrame used to manage the popup window? Just to be on the safe side, have you tried to open a different page (or use a page that does not rely on code-side javascript registration)?
    – SPArcheon
    Commented Apr 2, 2012 at 8:27
  • Yes, I've tried Sven Gillis' anwser, and it works, but the problem is that I first need to store a var in my session-state and then open the new dialog. So I guess it's the clientscript-manager that is the problem... Any idea's how to fix that? Commented Apr 2, 2012 at 8:50

2 Answers 2


Yes, it is possibile. Just open the dialog as you normally would otherwise, no need for special code or anything.

To double check this, I would assume you could just open the same page in the popup - that way can simply click the same link again and again on each SPDialog, without needing to create multiple pages.


It should work normally. Instead of using server side code, just add the following snippet into your declarative markup of page 1.

<a href="javascript:OpenPopUpPage('/page2.aspx');">ShowMePage2!</a>

Inside your page 2 insert the same codesnippet and see if works.


  • And how would you do this if I need to put some data in my session-state? (I put a Guid in the session state of my button in a row on my gridview) Commented Mar 30, 2012 at 7:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.