Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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!


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

C#

//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);
    }

Javascript:

function openDialog(myUrl, myTitle) {
var options = {
    url: myUrl,
    width: 800,
    height: 600,
    title: myTitle,
    allowMaximize: true,
    showClose: true
};
SP.UI.ModalDialog.showModalDialog(options);
}

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

share|improve this question
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? –  SPArchaeologist Mar 30 '12 at 6:45
    
It doesn't work when I press the button in the second pop-up for the FIRST time –  Ruben Herman Mar 30 '12 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)? –  SPArchaeologist Apr 2 '12 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? –  Ruben Herman Apr 2 '12 at 8:50

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer

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.

Cheers

share|improve this answer
    
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) –  Ruben Herman Mar 30 '12 at 7:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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