ListPresentation Settings

Jan 29, 2015 at 10:02 PM
I have a content type for presentation settings. The setting I have is a string and I have it setup to show as a drop down. I have values configured like 1:12, 2:6, 3:4, etc

The text value that the user sees corresponds to the number of columns to use in the bootstrap grid layout. The second value is the number would tell me what bootstrap class would be need to be used. So if the user wanted a single column (1) then i would use the col-md-12 (12) in my template. My question is how do I access the text value of the setting? When I use @ListPresentation.Columns I get 12, but I would like to also be able to access the text value 1 in this example. Is this possible?
Jan 29, 2015 at 10:46 PM
try
var columnPresentation = ListPresentation.Columns[0]; 
and then you can get the other things in the entity like
@columnPresentation.whateveryounamedyourtextfield
Armand
2DNN
Jan 29, 2015 at 10:48 PM
oops I read it wrong you have it setup as a drop down not as an entity
Coordinator
Jan 30, 2015 at 10:15 AM
The dropdown always has a saved-value, and a user-visualization for the edit-mask. Only the "real" value is stored. This is important in many scenarios, but usually you'll want to
  • Define the "real" value as technical-value that you need (like "12" in your example") and show a nice text to the user.
  • The user-text cannot be retrieved in the template, since that's using the dropdown the wrong way around.
Best, Daniel
Jan 30, 2015 at 10:32 AM
Thanks! I ended up changing the values just a bit in for the dropdown and just doing some basic math in the template to figure out what class to use based on how many columns the user wants to see.