I have created a web part in which there is one taxonomy picker control to enable user to select department.

I want to store the selected term to the list column which is of type Managed Metadata.

The declarative part is:

        <asp:Label ID="lblProjectOwnerDepartment" runat="server" Text="Owner Department"></asp:Label>
        <Taxonomy:TaxonomyWebTaggingControl OnLoad="taxProjectOwnerDepartment_Load" ID="taxProjectOwnerDepartment" runat="server" Visible="true" IsDisplayPickerButton="true" IsMulti="false"
              AllowFillIn="false" IsAddTerms="false" IsIncludePathData="false"></Taxonomy:TaxonomyWebTaggingControl>


        <asp:CustomValidator ID="cvProjectOwnerDepartment" runat="server" OnServerValidate="cvProjectOwnerDepartment_ServerValidate"  />


How do I get the terms? I searched over internet but only found the articles to get terms from sharepoint.

Please help.

2 Answers 2


TaxonomyWebTaggingControl on the server side

TaxonomyWebTaggingControl.Text Property is used to set or get value that represent a Term object

Get values from this control as pairs of labels and GUIDs. The delimiter between a label and a GUID is the | character. When using multiple values, delimit them with a ; character. Example: term1|12345678-1234-1234-1234-123456789012;term2|87654321-4321-4321-4321-210987654321

TaxonomyWebTaggingControl on the client side

There is an alternative way to access and manipulate TaxonomyWebTaggingControl from client side Client side

For example to get Taxonomy control value

//Get Taxonomy ControlObject value
//webTaggingId - TaxonomyWebTaggingControl ID  
function getTaxonomyControlObjectValue(webTaggingId) {
    var webTaggingCtl = $get(webTaggingId);
    var taxCtlObj = new Microsoft.SharePoint.Taxonomy.ControlObject(webTaggingCtl);
    var termValue = taxCtlObj.getRawText();
    return termValue;

For more details refer this post - Using SharePoint TaxonomyWebTaggingControl control: Access and manipulate from client side


Control Definition

<Taxonomy:TaxonomyWebTaggingControl id="**txtFileType**" runat="server" IsAddTerms="True" IsDisplayPickerButton="True" AllowFillIn="false">

How to call from javascript

var txtFileType = GetTerm("txtFileType");

Javascript function

function GetTerm(controlname) {

    var inputs = document.getElementsByTagName('span');
    for (var i = 0; i < inputs.length; i++) {

            if (inputs[i].id.indexOf(controlname) > 0) {
                var b = inputs[i].getElementsByTagName("input");

                    if(b[0].value == "")    
                        return "";

                    if(b[0].value.indexOf("|") == -1 || b[0].value.indexOf("-2222-2222-2222-") > 0)
                                alert("Invalid value " + b[0].value.split("|")[0] + ". Please select from list");
                                return "error";
                return b[0].value.split("|")[0];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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