Hi,
I've got a paragraph item, where I've got a field which is the field type "ItemType". This WidthSettings item I reuse a lot and it's working fine as long as I fetch the values within my paragraph template context... When I, on a ItemPublisher template, try to get the value from one of the selectboxes within the parent item (WidthSettings.WidthMobile) it throws an error: "System.NullReferenceException: Object reference not set to an instance of an object."
This code doesn't work:
@{ Dynamicweb.Content.Items.Item parentItem = Dynamicweb.Content.Items.ItemManager.Storage.GetById(Dynamicweb.Frontend.PageView.Current().CurrentParagraph.ItemType, Dynamicweb.Frontend.PageView.Current().CurrentParagraph.ItemId); string testvalue = parentItem["WidthSettings.WidthMobile"].ToString(); } @testvalue
But this code does work and renders the text from a richtext editor field on the parent item:
@{ Dynamicweb.Content.Items.Item parentItem = Dynamicweb.Content.Items.ItemManager.Storage.GetById(Dynamicweb.Frontend.PageView.Current().CurrentParagraph.ItemType, Dynamicweb.Frontend.PageView.Current().CurrentParagraph.ItemId); string testvalue = parentItem["Text"].ToString(); } @testvalue
Is there a special way to get the values from fieldtypes "ItemType"?