Export (0) Print
Expand All

TermProperty class

Provides a Web Part that renders a property of a Term, such as its default label, description, path, ID, or the value of one of its custom properties.

Namespace:  Microsoft.SharePoint.Taxonomy
Assembly:  Microsoft.SharePoint.Taxonomy (in Microsoft.SharePoint.Taxonomy.dll)

'Declaration
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
<AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
PublicNotInheritableClassTermProperty _
	InheritsWebPart
'Usage
DiminstanceAsTermProperty

The TermStoreID, TermSetID, TermID and Property properties are required to load the correct term and render the desired term property.

If either the term or the requested property is not found, the Web Part will render nothing.

This Web Part is the Term analogue to the ListItemProperty control that allows the author to render a property of a list item on the page.

The following code example uses the TermProperty control to render the name of a term with the specified IDs.

<Taxonomy:TermProperty
      TermID="4E2C0A64-A458-4287-8D00-147C4CBE11D0"
      TermSetID="9BFD8D2B-C391-49D5-A883-2B6CCF071CF1"
      TermStoreID="2B8BA5E1-3A8A-4C1A-8999-DB50550342CA"
      Property="Title"
      runat="server"/>

The next example uses the TermProperty control to render the value of a custom property defined on the term with key TargetUrl".

<Taxonomy:TermProperty
      TermID="4E2C0A64-A458-4287-8D00-147C4CBE11D0"
      TermSetID="9BFD8D2B-C391-49D5-A883-2B6CCF071CF1"
      TermStoreID="2B8BA5E1-3A8A-4C1A-8999-DB50550342CA"
      Property="CustomProperty:TargetUrl"
      runat="server"/>

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

Show:
© 2014 Microsoft