I am attempting to use a Taxonomy Picker Control (TaxonomyWebTaggingControl) on an Application Page based on the term set configured for a User Profile property. In this scenario, I have set the Ask Me About field to use a Term Set in the User Profile Service Application. When editing a user profile through the My Site or Central Admin, the field correctly displays as a Taxonomy Picker and allows me to select values from the Term Set.
In a new Application Page, I have registered the tag prefix:
<%@ Register Tagprefix="Taxonomy" Namespace="Microsoft.SharePoint.Taxonomy" Assembly="Microsoft.SharePoint.Taxonomy, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
And in the content I have added the control:
<Taxonomy:TaxonomyWebTaggingControl id="ngAskMeAbout" runat="server" />
In the Page_Load, I am first obtaining the term set from the User Profile property and then using it to get the term set from the Taxonomy Session:
var site = SPContext.Current.Site;
var context = SPServiceContext.GetContext(site);
var configMgr = new UserProfileConfigManager(context);
var propertyMgr = configMgr.ProfilePropertyManager;
var corePropertyMgr = propertyMgr.GetCoreProperties();
var askMeAbout = corePropertyMgr.GetPropertyByName("SPS-Responsibility");
var termSet = askMeAbout.TermSet;
ngAskMeAbout.Disabled = false;
ngAskMeAbout.Enabled = true;
ngAskMeAbout.Visible = true;
var taxonomySession = new TaxonomySession(site);
var termStoreId = termSet.TermStore.Id;
var termGroupId = termSet.Group.Id;
var termSetId = termSet.Id;
ngAskMeAbout.SspId.Add(termStoreId);
ngAskMeAbout.GroupId = termGroupId;
ngAskMeAbout.TermSetId.Add(termSetId);
ngAskMeAbout.AllowFillIn = false;
ngAskMeAbout.IsMulti = true;
ngAskMeAbout.IsAddTerms = false;
ngAskMeAbout.IsDisplayPickerButton = true;
ngAskMeAbout.IsIncludeTermSetName = true;
ngAskMeAbout.IsUseCommaAsDelimiter = false;
ngAskMeAbout.Language = taxonomySession.TermStores[termStoreId].DefaultLanguage;
ngAskMeAbout.AnchorId = Guid.Empty;
ngAskMeAbout.ExcludeKeyword = false;
ngAskMeAbout.IsIgnoreFormatting = false;
ngAskMeAbout.IsIncludeDeprecated = false;
ngAskMeAbout.IsIncludePathData = false;
ngAskMeAbout.IsIncludeUnavailable = false;
ngAskMeAbout.IsSpanTermSets = false;
ngAskMeAbout.IsSpanTermStores = false;
When I try running this, nothing renders on the page. I have debugged/stepped through the code to verify all the IDs are getting set properly and nothing generates an error.
Any ideas?