As we all know that sharepoint 2010 is opening a lot of forms in its newly featured model dialog.
Few of this pages are list forms like NewForm.aspx, EditForm.aspx, DispForm.aspx, pages while creating new object like list,site…etc.
While customize your sharepoint site, if by any chance you required any of your page to show in model dialog then below is the code for the same.
That page might have you custom webpart as well or anything will work.
Even JavaScript, query string, postback etc… available on that page because that page work similar as normal page it will also remove limitation of traditional model dialog.
If we want to refresh parent page after closing popup then also we can do that (as shown in code)
One more thing if you want to open another model dialog from already open model dialog then also this one is working
Few of this pages are list forms like NewForm.aspx, EditForm.aspx, DispForm.aspx, pages while creating new object like list,site…etc.
While customize your sharepoint site, if by any chance you required any of your page to show in model dialog then below is the code for the same.
function OpenDialog(strPageURL,strDialogTitle) {The good thing for us is you can open any page with this dialog.
//Creating New Object for SharePointDialog
var newDialogOptions = SP.UI.$create_DialogOptions();
//set URL for Dialog to open
newDialogOptions.url = strPageURL;
//you can set your custom size by setting height and width
autoSize: true,
//set title to show on head of dialog
newDialogOptions.title = strDialogTitle;
// This line required only if you want to call a function when we close dialog -- here we refresh the page
newDialogOptions.dialogReturnValueCallback = Function.createDelegate(null,CallbackFunc);
//open the dialog
SP.UI.ModalDialog.showModalDialog(newDialogOptions);
return false;
}
function CallbackFunc(result, target) {
//Refresh the current page
location.reload(true);
//some suggest to use below line but sometime this was not working
//so we are working on that
//SP.UI.ModalDialog.RefreshPage(SP.UI.DialogResult.OK);
}
That page might have you custom webpart as well or anything will work.
Even JavaScript, query string, postback etc… available on that page because that page work similar as normal page it will also remove limitation of traditional model dialog.
If we want to refresh parent page after closing popup then also we can do that (as shown in code)
One more thing if you want to open another model dialog from already open model dialog then also this one is working
No comments:
Post a Comment