Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I have document type that uses a checkbox list with some predefined values.
We use an importer to import data into these documenttypes and map to the predefined values.
If a predefined value does not exest I want to add it before we map it.
How can I get all the options/prevalues for the checkboxlist? and how can we add a new option/prevalue to the list?
Hope somebody can point me in the right direction.
I figured it out. This seems to do the job
private IDataTypeService _dataTypeService; public fieldProviderDropdown(IDataTypeService dataTypeService) { _dataTypeService = dataTypeService; }
inside the function:
var dataType = _dataTypeService.GetDataType("Regios List"); ValueListConfiguration prevalues = (ValueListConfiguration)dataType.Configuration; ValueListConfiguration.ValueListItem itemtest = new ValueListConfiguration.ValueListItem(); itemtest.Value = value.ToString(); itemtest.Id = prevalues.Items.Count+1; prevalues.Items.Add(itemtest); _dataTypeService.Save(dataType);
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Checkboxlist add prevalue from code
Hi,
I have document type that uses a checkbox list with some predefined values.
We use an importer to import data into these documenttypes and map to the predefined values.
If a predefined value does not exest I want to add it before we map it.
How can I get all the options/prevalues for the checkboxlist? and how can we add a new option/prevalue to the list?
Hope somebody can point me in the right direction.
I figured it out. This seems to do the job
inside the function:
is working on a reply...