Developer forum

Forum » Templates » Access to Item List in Page Settings from paragraph

Access to Item List in Page Settings from paragraph

Anders Ebdrup
Reply

Hello,

 

I find it a bit tedious to get an item relation list from my page setting inside a paragraph - so I would like to hear if this is the right way?

@{
    var pageOptionsId = Input.FormatInteger(Pageview.Page.PropertyItem["PageOptionIds"]);
    if (pageOptionsId > 0)
    {
        var itemRelations = ItemList.GetItemListById(pageOptionsId);
        foreach (var item in itemRelations.Relations)
        {
            var data = new Dictionary<string, object>();

            item.SerializeTo(data);

            <h1>@data["PageOptionDescrption"]</h1>
        }
    }
}

Best regards, Anders


Replies

 

You must be logged in to post in the forum