NavigationTermSetItem.TargetUrlForChildTerms property
Gets a string that specifies the default value of the target URL for child NavigationTerm objects.
Namespace: Microsoft.SharePoint.Publishing.Navigation
Assembly: Microsoft.SharePoint.Publishing (in Microsoft.SharePoint.Publishing.dll)
Syntax
'Declaration
Public ReadOnly Property TargetUrlForChildTerms As CustomizableString
Get
'Usage
Dim instance As NavigationTermSetItem
Dim value As CustomizableString
value = instance.TargetUrlForChildTerms
public CustomizableString TargetUrlForChildTerms { get; }
Property value
Type: Microsoft.SharePoint.Publishing.CustomizableString
A string that specifies the default value of the target URL for child nodes
Remarks
The TargetUrlForChildTerms property does not affect the current node.
This property is a CustomizableString object. The default value is inherited from the TargetUrlForChildTerms.Value property of the parent NavigationTerm() object or the NavigationTermSet object if there is no parent term. For the NavigationTermSet object, the default value is an empty string
Examples
Consider a website for which the NavigationTermSet should contain this hierarchy of terms:
- About Us
- Products
- Cars
- Trucks
- Motorcyles
- Contact
The following code will configure the friendly URLs for /products/cars, /products/trucks, and /products/motorcycles to share a common target page--/Pages/Rollup.aspx (with search-driven content). The parent friendly URL /producs will use a separate target page. void CreateProductsHierarchy(NavigationTermSet termSet)
{
NavigationTerm productsTerm = termSet.CreateTerm("Products", NavigationLinkType.FriendlyUrl);
productsTerm.TargetUrl.Value = "~site/Pages/Products.aspx";
productsTerm.TargetUrlForChildTerms.Value = "~site/Pages/Rollup.aspx";
productsTerm.CreateTerm("Cars", NavigationLinkType.FriendlyUrl);
productsTerm.CreateTerm("Trucks", NavigationLinkType.FriendlyUrl);
productsTerm.CreateTerm("Motorcycles", NavigationLinkType.FriendlyUrl);
termSet.GetTaxonomyTermStore().CommitAll();
}Note that in this example, using the TargetUrlForChildTerms property avoids the need to assign the same value to the TargetUrl for each of the child terms. If a new term is created, it will automatically inherit this setting.