One of the biggest improvements in SharePoint 2010 is the introduction of the Dialog Framework.  The Dialog Framework allows you to open pop-up dialogs inside of your browser window to present things such as forms.

New dialogs can be created using the SP.UI.ModalDialog.showModalDialog method (http://msdn.microsoft.com/en-us/library/ff410058.aspx).  The method takes in an options parameter which gives the details for what the dialog should display, such as the URL and the Title for the dialog.

Example:

function OpenMyWebPage() { 
    var options = { 
    url: "MySimpleDialog.aspx?isDlg=1", 
    width: 800, 
    height: 600, 
    }; 
    SP.UI.ModalDialog.showModalDialog(options); 
}

The easiest way to get started using the Dialog Framework is to create a wrapper function for creating your dialogs. Here is a simple wrapper function to use it with JavaScript:

function OpenDialog(url, title) 
{ 
    var options = SP.UI.$create_DialogOptions();  
    options.url = url; 
    options.title = title; 
    SP.UI.ModalDialog.showModalDialog(options);  
}
Advertisements