1

I am trying to access multilist field values in Visual studio ascx page using <asp:Repeater> web control. But i am not able to fetch the values from Sitecore. Which Sitecore webcontrol should we use to fetch multilist field values in repeater?

<sc:Image Field="Carousel Image" Item="<%# Container.DataItem %>" runat="server" />
<h1><sc:Text Field="Carousel Text" Item="<%# Container.DataItem %>" runat="server"/></h1>

1 Answer 1

2

You can use sc:Image and sc:Text in the repeater but you need to bind it to the list of items that are selected in the multilist field. A multilist field will have a (piped) list of guids as raw value, and you can get the items with the Sitecore API if you cast the field to a MultilistField:

var multilistfield = (MultilistField)field;
var items = multilistfield.GetItems();
repeater.DataSource = items;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.