HierarchicalTaxonField Control

Posted by Community Admin on 04-Aug-2018 23:07

HierarchicalTaxonField Control

All Replies

Posted by Community Admin on 16-Aug-2011 00:00

Hello-

I'm using a HierarchicalTaxonField on a page and am trying to set the selected value for the control.  I've tried via JavaScript and code behind without any success.

Here is the control definition on my page:

<sitefinity:HierarchicalTaxonField
        ID="HierarchicalFieldControl"
        runat="server"
        DisplayMode="Write"
        Expanded="true"
        ExpandText="ClickToAddCategories"
        ShowDoneSelectingButton="true"
        AllowMultipleSelection="false"
        TaxonomyId="E5CD6D69-1543-427b-AD62-688A99F5E7D4"
        BindOnServer="true"
        TaxonomyMetafieldName="Category"
        WebServiceUrl="~/Sitefinity/Services/Taxonomies/HierarchicalTaxon.svc" />

Then via C# I've tried setting the value like this:

HierarchicalFieldControl.Value = categoryId;

That did not work, so I also tried setting it via JavaScript.  The function is executed through Sys.Application.add_load, and the code to invoke the action looks like this:

hierarchicalFieldControl = $get('<%= HierarchicalFieldControl.ClientID%>');
hierarchicalFieldControl.control.set_value(categoryId.value);

And unfortunately that did not work either, but it did produce the following error:

"Guid should contain 32 digits with 4 dashes"

Which happened when the control attempted to perform a service call.  I checked both instances of code to confirm the categoryId values were proper GUIDs and the were both formatted like this:

d8743bac-8dde-45e3-b51b-bc61ed5e0631

Any insight or suggestions would be appreciated.

Thanks,

-Thomas

Posted by Community Admin on 19-Aug-2011 00:00

Hello Thomas Weidman,

When BindOnServer is true the Value of this field is cast to TrackedList<Guid>, which in turn inherits from IList<T>, ICollection<T>, etc., so all you need to do is create a new instance of this class and add the GUIDs of the selected taxonomies to it.

Greetings,
Lubomir Velkov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 22-Oct-2013 00:00

I've run into this problem myself and still haven't found a solution. Setting the Value to a TrackedList of Guids does nothing.

See this thread: 
www.sitefinity.com/.../setting-the-value-of-hierarchicaltaxonfield

This thread is closed