YASP Blog

All about Office 365, SharePoint, ASP.NET and web development in general

Main menu

Skip to content
  • Home
  • About
  • Samples

Search

Tag Archives: TaxonomyWebTaggingControl

January 23, 2013

Using SharePoint TaxonomyWebTaggingControl control: Access and manipulate from client side

Overview

In previous post we’ve discussed one of the useful features for TaxonomyWebTaggingControl control that  allows to specify ID of parent Term for any valid value in control. This could improve user experience in cases when subset of terms should be displayed for selection based on some conditions instead of displaying all terms from term set.

This time we will dig in a little bit to investigate how TaxonomyWebTaggingControl works and  illustrate  some examples how to access and manipulate TaxonomyWebTaggingControl on the client side.

TaxonomyWebTaggingControl

Before we proceed let me clarify some details about TaxonomyWebTaggingControl control itself.

TaxonomyWebTaggingControl ASP.NET control is a server side wrapper for ScriptForWebTaggingUI client control. One of the main purposes of TaxonomyWebTaggingControl control is to provide the ability to initialize ScriptForWebTaggingUI  control by generating parameters on the server side (see table 1).

It is interesting to note here that ScriptForWebTaggingUI was built using Script#.  Script# is a development tool that generates JavaScript by compiling C# source code. It means that ScriptForWebTaggingUI was originally created by Microsoft as C# control  and this  is another  great example of  using Script# for building real world applications.

ScriptForWebTaggingUI control properties

Table 1. ScriptForWebTaggingUI client control properties .

InputFieldId  Input field ID that is used for storing term value
SspId IDs of the TermStore objects that this control will validate against
GroupId Gets and sets the IDs of the Group object that this control will validate against
TermSetId Gets the IDs of the TermSet object that this control will validate against
AnchorId Get or set the ID of the Taxonomy whose children will be used to validate against
IsMulti Gets or sets whether this control accepts multiple Term objects
AllowFillIn Gets or sets whether this control will give the option of adding new Term objects if the Open() property is set.
WidthCSS Gets or sets a CSS class that will be applied to the control that should specify a width CSS class.
Lcid Gets or sets the LCID repesenting the language this control will validate against.
IsSpanTermSets Gets and sets whether this control will resolve against all TermSet objects or only the TermSet objects provided.
IsSpanTermStores Gets or sets whether this control will resolve against all TermStore objects or only the TermStore objects provided.
IsIgnoreFormatting Gets or sets whether this control will format valid and invalid Term objects or leave them as plain text.
IsIncludeDeprecated Gets or sets whether this control will resolve against deprecated Term objects.
IsIncludeUnavailable Gets or sets whether this control will resolve against unavailable Term objects.
IsIncludeTermSetName Gets and sets whether this control will resolve against the names of TermSet object names.
IsAddTerms Gets and sets whether this control will try to add unresolved Term objects to the TermSet object.
IsIncludePathData Gets or sets whether this control will include the full GUID path for all Term objects.
IsUseCommaAsDelimiter Gets or sets whether this control will use a comma in addition to a semi-colon as a delimiter.
Disable Gets or sets whether this control is disabled or not
ExcludeKeyword Gets and sets whether this control will resolve against keyword Term object or not
WebServiceUrl Gets and sets the URL of the TaxonomyInternalService that will be used to resolve against
FieldName Gets and sets the value that will be shown in the ToolTip on the client
FieldId Gets and sets the id of field
DisplayPickerButton Gets or sets whether this control will allow browsing with the picker

Relevant properties for server side TaxonomyWebTaggingControl control are listed here.

Microsoft.SharePoint.Taxonomy client namespace in SharePoint 2010

Table 2.  The following table lists classes used for ScriptForWebTaggingUI control

HighlightResult
ScriptForWebTaggingUI Represents container for ControlObject
ControlObject Represents control itself
Term Defines Term on the client side
ScriptResources
PanelResizer
SelectionMadeEventArgs
SuggestionContainer
SuggestionGroup
Suggestion

Access and manipulate TaxonomyWebTaggingControl from client side

To manipulate term values in TaxonomyWebTaggingControl control we’ll use Client Object model for Taxonomy listed in table 2, in particular ControlObject capabilities.   Below are provided methods for getting and setting values in TaxonomyWebTaggingControl on the client side

To find TaxonomyWebTaggingControl on the client side  webTaggingId identifier is used, that corresponds to ContainerId property of control.

Usage

Testing data

For demonstration purposes we’ll use information about countries that  has the following structure:

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

CountriesTermSet

Example 1. Setting TaxonomyWebTaggingControl control value

Example 2. Getting TaxonomyWebTaggingControl control value

In this example is demonstrated how to get  term value from

Example 3.Retrieve ScriptForWebTaggingUI control properties

For every instance of TaxonomyWebTaggingControl control placed on page is generated corresponding ScriptForWebTaggingUI control that could be used to retrieving properties as shown below:

References

  • Script# Project
  • SharePoint 2010 JavaScript Class Library
  • How to Work with Managed Metadata Columns by Using the SharePoint Client Object Model
Advertisements
  • Posted in JavaScript, JQuery, SharePoint 2010
  • Tagged JavaScript, Managed Metadata Column, Managed Metadata Service, MMS, ScriptSharp, TaxonomyFieldValue, TaxonomyWebTaggingControl, Term, TermSet, TermStore
  • 21 Comments
January 21, 2013

Using SharePoint TaxonomyWebTaggingControl control: specifying parent terms

Overview

TaxonomyWebTaggingControl represents a generic Web control for picking managed metadata terms.

During initialization two properties are mandatory to bind this control with Managed Metadata Service (MMS):

  • TermStore
  • TermSet

Below is presented example how to initialize it

Country picker

Let us consider the case when not all terms for the term set should be shown but a subset only. Assume we have the following structure for the countries:

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

CountriesTermSet

and our goal to display countries in TaxonomyWebTaggingControl only for selected continent as shown below

TaxonomyWebTaggingControl

This could be achieved by setting AnchorId property for TaxonomyWebTaggingControl control that allows to specify ID of parent Term for any valid value in control.

Implementation

Country picker allows to select continent/country from Countries term set.

Depending on the selected continent  only countries specific  for  continent are shown in TaxonomyWebTaggingControl control

CountryPicker

The code below contains Country Picker implementation:

  • Posted in SharePoint 2010
  • Tagged Managed Metadata Service, TaxonomyWebTaggingControl, Term, TermSet, TermStore
  • 1 Comment

Post navigation

profile for Vadim Gremyachev on Stack Exchange, a network of free, community-driven Q&A sites

Recent Posts

  • Consume SharePoint Online REST service using .NET
  • Consuming the SharePoint Online REST API from PowerShell: Part 2
  • Enterprise Keywords management in Office 365 via CSOM
  • An alternative way of getting Client Object properties using SharePoint REST and CSOM APIs
  • Manage User Custom Actions in Office 365

Archives

  • April 2015
  • January 2015
  • November 2014
  • September 2014
  • August 2014
  • July 2014
  • May 2014
  • April 2014
  • March 2014
  • February 2014
  • January 2014
  • November 2013
  • October 2013
  • September 2013
  • August 2013
  • June 2013
  • May 2013
  • April 2013
  • March 2013
  • February 2013
  • January 2013
  • December 2012
  • November 2012
  • October 2012
  • September 2012
  • July 2012
  • May 2012
  • April 2012
  • July 2010

Categories

  • ASP.NET
  • ASP.NET WebForms
  • ECM
  • Google Analytics
  • Google API
  • Google Chart Tools
  • Google Maps
  • JavaScript
  • JQuery
  • Nintex
  • Nintex Workflow
  • Office 365
  • OSS
  • PHP
  • PowerShell
  • SharePoint
  • SharePoint 2010
  • SharePoint 2013
  • SharePoint Online
  • Uncategorized
  • XSLT
  • YouTube

Meta

  • Register
  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.com
Advertisements
Create a free website or blog at WordPress.com.
Cancel
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy