Repeater - Get parent document fields

Andy Boot asked on June 4, 2014 08:23

Hi there,

I'm hoping this will be an easy answer.

My current structure:

/
/Events
/Events/Venue
/Events/Venue/Date1
/Events/Venue/Date2

Document Types:

Venue - CMS.Event
Date1/Date2 - CMS.BookingEvent

My Events page contains a repeater targeting the CMS.BookingEvent doctype where it is looping and retrieving records/documents in a list from an ASCX transformation.

My objective: Upon displaying the CMS.BookingEvent (Date1 or Date2) fields, also inherit the CMS.Event fields (Venue) so I can show the venue location side by side with the event dates. Note, there may be multiple venues and dates than in the above example structure.

If anybody can help that would be much appreciated.

Many Thanks,

Andy

Correct Answer

Andy Boot answered on June 6, 2014 08:21

Hi there,

I've managed to answer this for myself.

For those interested:

<%# CurrentDocument.Parent["EventName"] %>
1 votesVote for this answer Unmark Correct answer

Recent Answers


Brenden Kehren answered on June 4, 2014 12:07

Sounds like a perfect opportunity to use content inheritance.

0 votesVote for this answer Mark as a Correct answer

Andy Boot answered on June 5, 2014 03:24

Hi there, My Events template already has content inheritance set up, however I'm unable to figure out how to display the field data from the inherited documents within my repeaters transformation.

Here's my transformation displaying the CMS.BookingEvent document type:

<div class="eventTile">
<h3><%# Eval("EventName") %><br/><strong><%# getDayWithSuffix(Eval<DateTime>("EventDate")) + GetDateTime("EventDate"," MMMM") %></strong></h3>
<span><strong>Location: </strong><%# Eval("EventLocation") %></span>
<span><strong>Time: </strong> <%# Eval("EventTimeStart") %></span>
</div>

Note: EventName is a field from the CMS.Event doucment type

Thanks, Andy

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.