Friday, November 4, 2011

How to Embed Managed Metadata into Publishing Page Layout

Managed metadata is a hierarchical collection of managed terms that we can define, and then use as attributes for items. This post details how to add these types of fields to a publishing page layout so that content authors can add metadata and keywords to webpages they create using these layouts.
First we need to have a content type created which have added a site column of Managed Metadata type.  

Step 1: We have to register Microsoft.SharePoint.Taxonomy namespace in the page layout.

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


Step 2: We can use TaxonomyFieldControl class to add managed metadata field to the page layout. TaxonomyFieldControl provides the edit experience for a TaxonomyField object.

<Taxonomy:TaxonomyFieldControl ID="metadataPlaneTreeTaxonomy" FieldName="Plane Tree Taxonomy" runat="server">Taxonomy:TaxonomyFieldControl>


The taxonomy field control contains a taxonomy Web tagging control, which is responsible for initializing a new instance of the Web tagging control with all of the properties for the TaxonomyField object.

3 comments:

Anonymous said...

Good worked for me Like charm, thanks for the post

Anonymous said...

Hi

Can we specify a default value for this control?

Pretty Little GFX said...

Thiss is a great post