Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Daniel Pazos 6 posts 86 karma points
    Sep 16, 2020 @ 16:16
    Daniel Pazos

    How to create a Master-Detail Page


    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
  • Matthew Mirzai 25 posts 120 karma points
    Sep 16, 2020 @ 19:50
    Matthew Mirzai

    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.

  • Daniel Pazos 6 posts 86 karma points
    Sep 17, 2020 @ 08:52
    Daniel Pazos

    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.

Please Sign in or register to post replies

Write your reply to: