1
votes

I relatively new to Umbraco but using a somewhat contrived pet project I'm making good progress up the steep leaning curve.

My pet project is a 'simple' magazine database which will store details of my monthly subscriptions including the articles therein. Hopefully (when finished) I'll be able to search the database to fine which issue a particular article is in rather than trawling through them by hand.

The problem I have is that I want to include the details of the Cover Discs and have summary information displayed on the detail page for the magazine. I've created a Document Type for the Cover Disc and added a 'coverDisc' property to the Magazine Document Type which is set via a Content Picker. All goes well in the creation/editing of the Magazine and I can associate a Cover Disc which I've already created.

When I come to the template though, that's where I hit my problem - how do I access the Cover Disc from the @Model which is available to me? I've Googled about for quite a while but only seem to find XSLT solutions which address vaguely similar issues.

I'm using the current version of Umbraco (4.9.1) and for the time being I'm working in the Umbraco environment, not Visual Studio (although that's ultimately where I'll want to end up).

Any pointers gratefully received.

1

1 Answers

3
votes

Check out my answer to this question, for an answer to your question as well as some good resources for learning Umbraco's razor.

Basically, you'll do something like:

dynamic node = Library.NodeById(Model.coverDisc);

...to access the linked cover disc node, and then access the properties the same way you would on Model:

@node.Name