#Umbraco 8: Getting properties from another page

1 messages · Page 1 of 1 (latest)

wispy bay
#

I have a block deined in my blocklist that will then render all case studies from my case studies node (all the child pages) - I have managed to get the links rendering but what I am struggling to do is now getting the proprties from those pages to render in my loop.

So for example the featured image, excerpt I need to render out.

Case Studies Block: https://prnt.sc/5j_sSZPVhBva

Here is my code for the caseStudiesBlock.cshtml

`@using Umbraco.Core.Models.Blocks
@inherits UmbracoViewPage<BlockListItem<CaseStudiesBlock>>

@{
var selection = Umbraco.Content(Guid.Parse("4e8ec5ad-3d6c-4b11-9253-5e2f8a6a1a26"))
.ChildrenOfType("caseStudy")
.Where(x => x.IsVisible())
.OrderByDescending(x => x.CreateDate);

var caseStudiesNode = Umbraco.Content(Guid.Parse("4e8ec5ad-3d6c-4b11-9253-5e2f8a6a1a26"));
var caseStudiesNodeUrl = caseStudiesNode?.Url();

}

<section class="inner-right">
<h2>@Model.Content.CaseStudiesTitle</h2>

<div class="case-studies-link" style="float:right; padding-right:5vw; margin-top:-50px;">
    <a href="@caseStudiesNodeUrl" style="color:#0F2C43; font-weight:bold; text-decoration:underline;">
        Case Studies
    </a>
</div>

<div class="clear"></div>

<ul>
    @foreach (var item in selection)
    {
        //var rowItem = (CaseStudiesBlock)item.Content;

        <li>
            <a href="@item.Url">@item.Name</a>
        </li>
    }
</ul>

</section>`

My case study doc type: https://prnt.sc/kXGED3owIA43

Lightshot

Captured with Lightshot

Lightshot

Captured with Lightshot

#

Figured it out, I was having a brainfart moment!

string caseStudyExcerpt = item.Value<string>("excerpt");

@caseStudyExcerpt did the trick!

little vortex
#

I can always recommend ModelsBuilder for doing this, makes it so much easier 🙂