i need this to get the prevalues of a Datatype with GetPreValuesByDataTypeId(xxx)
Alternatively: I have the node of a page of my side that belongs to a datatype, how can i get the prevalues of this datatype? (the datatype is created manually by me )
var dataTypeService = ApplicationContext.Current.Services.DataTypeService;
var allTypes = dataTypeService.GetAllDataTypeDefinitions();
//Replace Data Type Name with the name of the required datatype
var typeId = allTypes.First(x => "Data Type Name".InvariantEquals(x.Name)).Id;
If you are trying to get the prevalues of your data type, the following can be used:
var values = dataTypeService.GetPreValuesByDataTypeId(typeId);
Get ID of a DataType By its Alias
Hey,
how do i get a DataType ID by its Alias in Razor?
i need this to get the prevalues of a Datatype with GetPreValuesByDataTypeId(xxx)
Alternatively:
I have the node of a page of my side that belongs to a datatype, how can i get the prevalues of this datatype?
(the datatype is created manually by me )
Hi yves
What version of Umbraco are you using?
Cheers
Ali
i am using v7.1.6
@Yves
I have got the following code running in 7.1.8:
If you are trying to get the prevalues of your data type, the following can be used:
Good luck!
is working on a reply...