Tuesday, 29 July 2008
« How To Switch Between Remote Desktop Ses... | Main | SharePoint People Picker and Changing Au... »
I was trying to use a DataPager and ListView control in a custom MOSS page layout, but these 2 controls were causing parser errors:

Server Error in '/' Application.

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Unknown server tag 'asp:DataPager'.

Source Error:

Line 25: 	<div class="pageContent">
Line 26:
Line 27: <asp:DataPager ID="Pager" runat="server" PagedControlID="lstvNews" PageSize="10" QueryStringField="page" class="paging">
Line 28: <Fields>
Line 29: <asp:NextPreviousPagerField ButtonType="Image" ShowFirstPageButton="True" FirstPageImageUrl="img/arrow-left.gif" ShowNextPageButton="False" ShowPreviousPageButton="False" />

Source File: /_catalogs/masterpage/News.aspx    Line: 27

Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

These 2 controls live in a separate assembly to your regular ASP.NET controls, called System.Web.Extensions.dll, which by default SharePoint knows nothing about as SharePoint predates the release of this assembly.

To get SharePoint to recognise these controls you need to ammend your SharePoint site's web.config, usually found in C:\Inetpub\wwwroot\wss\VirtualDirectories\[your site's port number]\web.config

First, add the assembly to the list of safe controls:

<SafeControl Assembly="System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" Namespace="System.Web.UI.WebControls" TypeName="*" Safe="True" AllowRemoteDesigner="True" />

 Then, locate the <pages> node under <system.web> and add the following to <pages>:

        <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

Once you've made these ammendments the parser error should go away

Tuesday, 29 July 2008 11:06:14 (GMT Standard Time, UTC+00:00)  #      Comments [0]  |  Trackback