Posted on 03/12/2014 15:54:16
The value of item["Indhold"] is a comma-separated list of item ids and you have to use the Items API to get the actuals items from this list.
You can do this using helper methods like these
@using Dynamicweb.Content.Items
@functions {
IEnumerable<Item> GetItems(List<string> ids, string itemType)
{
using (var repo = ItemManager.Storage.Open(itemType))
{
return repo.SelectByIds(ids).OrderBy(i => ids.IndexOf(i.Id)).ToList<Item>();
}
return null;
}
IEnumerable<Item> GetItems(string ids, string itemType)
{
return GetItems(ids.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList<string>(), itemType);
}
}
In your template you can then use GetItems like this
@foreach (var i in GetItems(item["Indhold"] as string, «item type of item list items»))
{
…
}
Best regards,
Mikkel