Ads

Saturday, 31 May 2014

Modal Window Using JavaScript in SharePoint

2 ways to open SharePoint Modal Window using JavaScript:

1. Using the DialogOptions class.
var options = SP.UI.$create_DialogOptions();

options.title = "My Dialog Title";
options.width = 400;
options.height = 600;
options.url = "/_layouts/DialogPage.aspx";

SP.UI.ModalDialog.showModalDialog(options);

2. Using a generic object.
var options = {
    title: "My Dialog Title",
    width: 400,
    height: 600,
    url: "/_layouts/DialogPage.aspx" };

SP.UI.ModalDialog.showModalDialog(options);

Ref.: http://msdn.microsoft.com/en-us/library/ff410058(v=office.14).aspx

No comments:

Post a Comment

Ads