On button click I am opening a modal popup and containing a custom webpart. The custom webpart inside the modal popup has a button, on click of this I want to open another modal popup but while doing this I want to close the parent modal popup.
I was not able to to this so I used Response.Redirect("Test.aspx");
but this opens the page inside the same modal dialog, with master page and no ribbons. I don't want the SP ribbon nor do I want the masterpage. I detached the master page for that particular page but I still get the page with masterpage. Does any one know how to do this?
Please guide me as to how to close parent Modal Dialog and at same time open a new Modal Dialog or any other method in which the Test Page is shown in the same modal dialog.
Code:
function openModalDialogYourDetails(Stringurl, width, height,modaltype,fieldname,empname) {
var modaltitle="";
if(modaltype==1)//Edit Modal Dialog
{
modaltitle="Effective Date changes for " + fieldname + " - " + empname ;
}
else if(modaltype==2)//History Modal Dialog
{
modaltitle=fieldname + " History - " + empname;
}
//Check what has caused the modal to open and set hidden variable
if(Stringurl.indexOf('Job') !== -1)
document.getElementById("<%=Modalcause.ClientID%>").value = "Job";
if(Stringurl.indexOf('work') !== -1)
document.getElementById("<%=Modalcause.ClientID%>").value = "work";
options = SP.UI.$create_DialogOptions();
if(modaltitle!="")
{
options.title = modaltitle;
}
options.width = width;
options.height = height;
options.url = Stringurl;
options.dialogReturnValueCallback = Function.createDelegate(null, modalDialogClosedCallback);
SP.UI.ModalDialog.showModalDialog(options);
}
and closeCallBack
function as mentioned in the answer
function modalDialogClosedCallback(dialogResult, returnValue) {
// Depending on what data you get in your 'result' param
// your logic to open the new dialog goes here.
alert(dialogResult);
alert(returnValue);
var options = SP.UI.$create_DialogOptions();
options.width = 800;
options.height = 650;
options.url = dialogResult;
SP.UI.ModalDialog.showModalDialog(options);
}