Developer forum

Forum » CMS - Standard features » Items - is it not possible to show chekcbox label?

Items - is it not possible to show chekcbox label?

Hans Ravnsfjall
Reply

See attachment.

 

I would like to display/render Checkbox (or dropdown) label as I can edit the label without loosing any data. Something I canĀ“t do with the Value. It is beeing stored somewhere, so I am sure this should be possible. Please let me know.

checkbox_label.jpg

Replies

 
Hans Ravnsfjall
Reply

I am trying on a solution that is running on version 8.5.1.19, and it can be seen here - www.les.fo

 

I am using the Item publisher to display a list of items, and would like to display the Label of selected checkboxes.

 
Rene Poulsen
Reply
This post has been marked as an answer

Hi Hans,

When you've got a dropdown there should be a loop for the options in that dropdown. In the loop you can access the label, the value, "IsSelected". (I've used this on a solution running 8.6. Don't know if its there in 8.5.1.19, but I think it is.)

So if you have a dropdown with the system name "Color" you can loop the options somthing like this:

@foreach (var option in GetLoop("Item.Color.Options")) {
    @if (option.GetBoolean("Item.Color.Option.IsSelected") {
        <div>This is the one! The label is: @option.GetValue("Item.Color.Option.Value")</div>
    }
}

Hope it works on 8.5.1.19 :-)

Votes for this answer: 1

 

You must be logged in to post in the forum