The problem is that the required SharePoint JavaScript library was not loaded. (SharePoint 2010 JS is a good bit of clutter, namespaces, etc. the issue is complicated by a new on-demand download).
The library that must be loaded to use the Modal Dialog SP2010 interface (including $create_DialogOptions and showModalDialog ) is "sp.js".
To provide sp.js downloads:
ExecuteOrDelayUntilScriptLoaded(function () { // do modal dialog stuff in here (or in another function called from here, etc.) }, "sp.js")
The callback function is called only after "sp.js" (including the material SP.UI.ModalDialog ) is loaded (and it can never be called if there is a loading error).
This could also be solved using <ScriptLink> to sp.js with OnDemand , but I can’t guarantee it: (I think there might have been problems with this approach, but I can’t remember why it wasn’t used in the project I just looked at.)
<SharePoint:ScriptLink runat="server" Name="sp.js" OnDemand="true" Localizable="false" />
See SPSOD for more details / information.
Happy coding.
user166390
source share