Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Assuming I have a term set with all the countries. The first level is the continents The second level is the countries. No I am building a web part with a dropdown of the continents and a WebTaggingControl from the term set. How can I force the WebTaggingControl to show only the continent selected in the dropdown?

The actual usage is not with countries but this is a good representation of the issue :-)

Thanks in advance

share|improve this question
add comment

1 Answer

It could be accomplished by specifying AnchorId property for TaxonomyWebTaggingControl control.
This property allows to specify ID of parent Term for any valid value in control.


Assume we have the following structure for the countries:

  • the first level is the continents
  • the second level is the countries

enter image description here

If we initialize TaxonomyWebTaggingControl control and specify for AnchorId Europe Term Id value

 /// <summary>
/// Initializing TaxonomyWebTaggingControl control
/// </summary>
/// <param name="countryControl"> </param>
/// <param name="session"></param>
/// <param name="continentTerm"></param>
private void InitCountriesControl(TaxonomyWebTaggingControl countryControl, TaxonomySession session, Term continentTerm)
{
    countryControl.SSPList = continentTerm.TermStore.Id.ToString();
    countryControl.AnchorId = continentTerm.Id;
    countryControl.TermSetList = continentTerm.TermSet.Id.ToString();
}

then only countries for selected continent will be displayed

enter image description here

For more details and how to implement Country picker based on Countries term set please see my blog - Using SharePoint TaxonomyWebTaggingControl control: specifying parent terms

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.