0

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 Answers1

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.

iJungleBoy
  • 5,325
  • 1
  • 9
  • 21
  • I feels good with entity, but just wondering... So it would be a non-sense for a 2sxc future release store a dictionary label-value? – Giovanni Manzo Oct 18 '16 at 21:14
  • @GiovanniManzo sorry, I don't get the question :) – iJungleBoy Oct 18 '16 at 21:37
  • I was just thinking it would be useful to have the label stored somewhere, such as in a dictionary to be able to show, maybe it's something more immediate than to create a separate entity... But if that for 2sxc does not make sense, it does not matter, the important thing is to have a way to do it :) – Giovanni Manzo Oct 19 '16 at 16:32