HierarchicalTaxonField Control
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"
/>
HierarchicalFieldControl.Value = categoryId;
hierarchicalFieldControl = $get(
'<%= HierarchicalFieldControl.ClientID%>'
);
hierarchicalFieldControl.control.set_value(categoryId.value);
d8743bac-8dde-45e3-b51b-bc61ed5e0631
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,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