DotNet Mirror
  DNM facebook   DNM Google+   DNM Twitter   

SP.UI.$create_DialogOptions is not a function issue in visual webpart

By Ashok Nalam on 16 Apr 2013 | Category: Sharepoint | Tagged: error 
  Discuss Add Comment   |  
Add rating Rate this resource   
When we try to invoke the SharePoint modal dialog from visual webpart, sometimes we will get an error as "SP.UI.$create_DialogOptions is not a function". In order to resolve the issue, explicitly call LoadSodByKey function from document ready method of visual webpart.
$(document).ready(function () {
LoadSodByKey("sp.js", function () {});
InvokeSPDialog();
});
SharePoint modal dialog:
function InvokeSPDialog() {
    var diaOptions = SP.UI.$create_DialogOptions();
    diaOptions.url = 'http://siteurl/_layouts/15/Test.aspx',
    diaOptions.title = "Test";
    diaOptions.width = 300;
    diaOptions.height = 100;
    diaOptions.dialogReturnValueCallback = Function.createDelegate(null, CloseCallBack);
    SP.UI.ModalDialog.showModalDialog(diaOptions);
}
function CloseCallBack(result, returnValue) {
        alert('ok');  

}
Hope this resolves the issue!
  Discuss Add Comment    
Add rating Rate this resource   
About the Contributor
Member Since : 10 Dec 2012
Member Points (Level) : 9226  (Professional)
Location : INDIA
Home Page : http://dotnetmirror.com
About : I am admin of this site.
Rate this resource
 
Add your Comment
Name Email WebSite
Captcha Refresh


Comments (0)
No comments found, click here to add comment.
 
cheap jordans|wholesale air max|wholesale jordans|wholesale jewelry|wholesale jerseys