Reputation: 63
I have MultilistField in my Product Template, and datasource for multilist field is Images - i.e Product Images.
i want to retrieve the Image-URL from the Multilist field. can you please guide.
FYI, i dont have Glasmapper or TDS in my solution. can you provide basic sitecore approach
Upvotes: 1
Views: 383
Reputation: 27132
Just use GetItems()
method of MultilistField
and then call MediaManager.GetMediaUrl
method:
MultilistField mfField = Sitecore.Context.Item.Fields["mf_field_name"];
foreach (var item in mfField.GetItems())
{
var mediaUrl = Sitecore.Resources.Media.MediaManager.GetMediaUrl(new MediaItem(item));
}
Upvotes: 0