2

I am building a new VM for Development. In my Production environment I have a page that throws no errors and works correctly. However, when I try to look at this page in the new VM, I get the error "Type is undefined" in reference to this line: Type.registerNamespace('SP')

I found this articles saying to add the following script will fix the problem but it does not work for me.

https://ajax.aspnetcdn.com/ajax/4.0/1/MicrosoftAjax.js

The following is a page that works in Prod but not in my new VM.

<%@ Page language="C#" MasterPageFile="~masterurl/default.master"    Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage,Microsoft.SharePoint,Version=15.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c"  %> <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint" %> <%@ Assembly Name="Microsoft.Web.CommandUI, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">

    <SharePoint:ScriptLink Name="SP.UI.Dialog.js" runat="server" />



</asp:Content>

    <input id="Splash_btn" onclick="SP.UI.ModalDialog.commonModalDialogClose(SP.UI.DialogResult.OK,true)" type="button" value="I AGREE"/>

</asp:Content>

The line that causes the error is:

<SharePoint:ScriptLink Name="SP.UI.Dialog.js" runat="server" />

If I remove this line, the SP.UI.ModalDialog code does not work. It seems odd that I have to explicitly call SP.UI.Dialog.js but it works in Prod. Any idea how to resolve the error with my new VM?

  • Nothing specific comes to mind from the few details you have posted so far. I can only suggest some basic checks: 1) is the masterpage identical in the two environments? you should ensure there is no customization. 2) check if features like the incremental page download are in the same state on both environments, otherwise you should manage your feature on the dev site so that they are. – SPArchaeologist Jul 20 '16 at 17:43
0

Try the following:

<Sharepoint:ScriptLink ID="ScriptLink1" Name="sp.ui.dialog.js" LoadAfterUI="true" Localizable="false" runat="server"></Sharepoint:ScriptLink>

LoadAfterUI="true" worked for me.

Reference

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.