Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have a page that shows a nested content list with some information (title, description and a video link).
What I'm trying to do is to click on one of these elements and load a detail page with the same title, description and embed the video with the video link.
What is the best way in order to achieve this?
I've tried sending the Key value from the selected element, retrieve the model from the parent page and load the element but it is always null.
This is the code in my detail page:
var agendaModelList = Model.Parent.Value<IEnumerable<IPublishedElement>>("eventAgendaList");
foreach (var item in agendaModelList)
<p>@item.Key</p> // Returns 3f796162-b3e6-4eef-b1aa-bd198afe8eb8
var item = agendaModelList
.Where(x => x.Key.Equals("3f796162-b3e6-4eef-b1aa-bd198afe8eb8"))
.FirstOrDefault(); //Returns null
Could it be that you're doing an .Equals comparison between a string and a Guid, which would always return false? If you try
instead it should return a bool.
Thank you Matthew and shame on me :D
I don't know why I thought that Key was already a string and that something was wrong with my parent model.
Works like a charm now.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted