by Andreas

Sharepoint 2010 – Adding TaxonomyFieldControl to custom Page Layout

When attempting to add a taxonomy field control to your custom page layout, it will automatically be given a tag looking something similar to this:

<CustomTag_0:TaxonomyFieldControl FieldName="81d247d1-0373-4a2d-9e81-d4b69bf3e091" runat="server"></CustomTag_0:TaxonomyFieldControl>

When attempting to render this in Sharepoint Designer you’ll be told that “TagPrefix is not registered in this Web Form”:

image

If you’re one of those painfully optimistic characters you’ll still attempt to run it in the browser, which gives you the  ASP.NET error screen with the following message:

Parser Error Message: Unknown server tag ‘CustomTag_0:TaxonomyFieldControl”

For those who wants to dig even deeper than this, the following error message appears in the application event log:

Load control template file /_controltemplates/TaxonomyPicker.ascx failed: Could not load type ‘Microsoft.SharePoint.Portal.WebControls.TaxonomyPicker’ from assembly ‘Microsoft.SharePoint.Portal, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c’.

 

The solution is simple: just add a reference to the assembly which contains the Taxonomy Picker control at the top of your Page Layout:

<%@ Register Tagprefix="Taxonomy" Namespace="Microsoft.SharePoint.Taxonomy" Assembly="Microsoft.SharePoint.Taxonomy, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

Then change the <CustomTag_0:TaxonomyFieldControl> to <Taxonomy:TaxonomyFieldControl> and off you go (remember there is a closing tag too, by the way..):

<Taxonomy:TaxonomyFieldControl FieldName="81d247d1-0373-4a2d-9e81-d4b69bf3e091" runat="server"></Taxonomy:TaxonomyFieldControl>