Dropdown List: assign value. Is there a new method?
Hi,
I'm using this code to assign value to dropdown datatype. is there a new mode to do this?
Thx
// I need to find the Id of the 'Reserved' prevalue option on the Status data type I created
var dts = ApplicationContext.Current.Services.DataTypeService;
// Get an instance of the status editor
var statusEditor = dts.GetAllDataTypeDefinitions().First(x => x.Name == "Vendor Request State");
//// Now we can fetch the pre-values collection, and use linq to find the Id for the 'Reserved' option
int preValueId = dts.GetPreValuesCollectionByDataTypeId(statusEditor.Id).PreValuesAsDictionary.Where(d => d.Value.Value == data.StatoRichiesta).Select(f => f.Value.Id).First();
var prevalues = dts.GetPreValuesCollectionByDataTypeId(statusEditor.Id);
foreach (var prevalue in prevalues.PreValuesAsDictionary)
{
LogHelper.Info<WFPraticheController>(prevalue.Value.Id.ToString());
LogHelper.Info<WFPraticheController>(prevalue.Value.Value);
}
post.SetValue(Vendor.GetModelPropertyType(x => x.StatoRichiesta).PropertyTypeAlias, preValueId);
Dropdown List: assign value. Is there a new method?
Hi,
I'm using this code to assign value to dropdown datatype. is there a new mode to do this? Thx
is working on a reply...