2

Here is the beginning of my custom SharePoint Application Page:

<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI.WebControls" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TrainingAssignmentForm.aspx.cs" Inherits="MyNamespace.TrainingAssignmentPage" DynamicMasterPageFile="~masterurl/default.master" %>

<asp:Content ID="PageHead" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
    <SharePoint:ScriptLink Name="SP.js" Language="javascript" Defer="true" runat="server" />
</asp:Content>
...

When I try to debug the page it cannot be loaded. Removing the <SharePoint:ScriptLink> tag clears the error. I need <SharePoint:ScriptLink> because I want to use SP.js in my code. Am I missing an assembly reference or something?

Here is the beginning of the code-behind page:

using System;
using System.Collections.Generic;
using Microsoft.SharePoint.WebControls;
using System.Web.UI.WebControls;
using Microsoft.SharePoint.Taxonomy;
using Microsoft.SharePoint;
using System.Linq;

namespace MyNamespace
{
    public partial class TrainingAssignmentPage : LayoutsPageBase
    {
        ....

I am using SharePoint 2010 and it is not a sandbox solution.

1

Try using the following:

<SharePoint:ScriptLink language="javascript" name="SP.js" defer="true" runat="server" Localizable="false"/>
|improve this answer|||||

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.