HierarchicalTaxonFieldDefinitionElement: null reference exception
Hello,
I create a new taxonomy in the module installation and I want to display its content using a HierarchicalTaxonFieldDefinitionElement.
Here is the code i'm using:
var taxonomyManager = TaxonomyManager.GetManager();
var marketsField =
new
HierarchicalTaxonFieldDefinitionElement(mainSection.Fields)
ID =
"marketsFieldControl"
,
DisplayMode = displayMode,
Title = Res.Get<ContactsResources>().SelectMarkets,
ResourceClassId =
typeof
(ContactsResources).Name,
TaxonomyId =
new
Guid(
"9A7FF96D-1D99-4fd9-ADB8-714E1A0F3272"
),
TaxonomyProvider = taxonomyManager.Provider.Name,
WebServiceUrl =
"~/Sitefinity/Services/Taxonomies/HierarchicalTaxon.svc"
,
AllowMultipleSelection =
true
,
FieldType =
typeof
(HierarchicalTaxonField),
WrapperTag = HtmlTextWriterTag.Li
;
marketsField.ValidatorConfig =
new
ValidatorDefinitionElement(marketsField)
Required =
true
,
MessageCssClass =
"sfError"
,
RequiredViolationMessage = Res.Get<ContactsResources>().YouMustSelectAMarket
;
mainSection.Fields.Add(marketsField);