2sxc: Dropdown list Get Label instead of value in

2019-09-07 01:30发布

问题:

I have a dropdown in my contents like this https://snag.gy/OxgeoA.jpg where I have got 3 "labels:value" options.
In my razor template I would like to get the label instead of the value.
With this I only get the value (for example 0,1,2)

@Content.Name

How can I get Labels please? (for example Negativo,Positivo,Non Testato of my screens).
Thanks you

EDIT: I found a temp solution making a new entity, but I don't know if it is the right way because I thought that with a dropdown content field type I would be able to get label instead of the value..?

回答1:

Those labels only exist in the edit-dialog. They are not stored with the value, and can be different in every language. So your solution to create entities is usually the best way to do it, alternately you could just keep an array in your code and look it up. But the entity-list is probably your best solution.



标签: 2sxc