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

Can I open SP.UI.ModalDialog within another ModalDialog?

I mean, I can, and opening works fine. What does not work, is closing second dialog. Neither default buttons for maximizing and closing window (in dialog's top bar) do anything, nor custom button with SP.UI.ModalDialog.close method.

Is it possible to successfully open and close a ModalDialog within ModalDialog?

share|improve this question
add comment

2 Answers

Yes it's possible. I have an example here that worked for me at least some time ago:

Function to open the first dialog:

function openRegAtt() {SP.UI.ModalDialog.showModalDialog(regAttOptions);}

JS inside the first dialog page:

function openAddPpl() {SP.UI.ModalDialog.showModalDialog(addPplOptions);}

Nothing special about it tbh, hard to say why it shouldn't work.

share|improve this answer
    
This is exactly how I open the dialog. But then I cannot close it. –  Tschareck Apr 9 '13 at 13:07
add comment
up vote 0 down vote accepted

Found solution to this problem:

First dialog had asp:Button, that would open second dialog. The JS method for this was in OnClientClick. What I noticed, was that button click would reload first page again.

I changed asp:Button to HTML button: <input type="button" onclick="OpenSubDialog('/_layouts/SecondForm.aspx')">. Also in second dialog, save/close button now calls JS to close from code-behind:

 HttpContext context = HttpContext.Current;
 context.Response.Write("<script type='text/javascript'>window.frameElement.commitPopup()</script>");
 context.Response.Flush();
 context.Response.End();
share|improve this answer
add comment

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.