Showing the Audience Target field in an EditModePanel #SharePoint #SP2010 #in #ProjectServer #PS2010
I have been meaning to blog about this since the public beta of 2010 but never quite got round to it until now!
I was reminded of the functionality we implemented for a client recently that allowed the Audience Target field to appear in the Edit Mode Panel of a Publishing page layout.
You would think that it would be easier, but after lots of digging around we finally found a solution.
Firstly in the Page Layout we need to register a new reference at the top of the page:
<%@ Register TagPrefix="OfficeWebControls" Namespace="Microsoft.Office.Server.WebControls.FieldTypes" Assembly="Microsoft.Office.Server.UserProfiles, Version=22.214.171.124, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
With this new reference in place we can now implement the field in a standard EditModePanel way like so:
<PublishingWebControls:EditModePanel runat="server" PageDisplayMode="Edit"> <table> <tr> <td> <span> Use if you wish to ‘push’ this content to a particular audience select here. Leaving it blank will make it available to all site users. </span> <br /> <OfficeWebControls:SPFieldTargetToControl ID="Audience" runat="server" FieldName="Audience" /> </td> </tr> </table> </PublishingWebControls:EditModePanel>