Hi,
I have an Item type which is going to have a field thats inherit another Item type as "Item relation List". But I can't get it to set the "Item type" of the list to my other type.
Now I removed that Item type and configured it in admin page instead. Anyone know how to set "item type" of the list?
Developer forum
E-mail notifications
How to set Item type from code first class
Replies
Can you please share your code - and maybe also you setup from the backend of the version that you configured instead?
Thanks, Nicolai
Hi,
I now attached a picture of my code where I have a property which should use "Ledningsgrupp" as it's itemtype on the list. My other itemtype name is "Ledningsgrupp" so I thought I just couuld create an ItemrelationListEditor field and its should be the same as the one I want to connect to. In this case "Ledningsgrupp". But maybe I miss some attribute to connect it. On picture 2 I have opened my field, but as you can see it not add my Item type "Ledningsgrupp". I also attached a picture of my "Ledningsgrupp" itemtype.
Yes, it is easy. It is better to use specialized attribute here: ItemRelationListAttribute
[ItemRelationList("Related news", "ExampleNewsItem")] [Option("Title"), Option("Subtitle"), Option("NewsType")] public int RelatedNews { get; set; }
[ItemRelationList("Related news", nameof(ExampleNewsItem), ItemRelationListEditor.ItemListSource.Page, "Title", "Subtitle")] public int RelatedNews { get; set; }
Hi,
Thanks so much for some code examples.
Regards
Andreas
You must be logged in to post in the forum