Mark Handy
Mark Handy

Reputation: 1256

Kentico 9 transformation and repeaters guidance

I'm trying to create a memo section. I'm using the corp site New section as a guide. Each memo has a From, To, Date, Subject, then details.

For the landing page i need the Date, Subject and From in a table layout, which i have a jquery plugin for column sorts.

The detail page is just the detail.

I have two transformations. My main has the following:

   <tr>
      <td>{%Date%}</td>
      <td><a href="{% GetDocumentUrl() %}">{%Re%}</a></td>
      <td>{%From%}</td>
    </tr>

My Selected item Transformation is as follows:

<section id="memoDetail">
    <ul>
      <li>To: <%# Eval("To") %></li>
      <li>From: <%# Eval("From") %></li>
      <li>Re: <%# Eval("Re") %></li>
      <li>Date: <%# Eval("Date") %></li>
      </ul>
  <div><%# Eval("Details") %></div>
</section>

When i tried this with the base repeater, I placed the table, thead, tbody and closing tags in the HTML envelope sections. This worked great, but it also placed the table on the detail page.

When i tried the basic table repeater, I had no data in the table.

I kinda lost on when i need to go to resolve this.

Upvotes: 0

Views: 348

Answers (2)

Rui
Rui

Reputation: 504

One more suggestion from best practice side. Since you have 2 repeaters retrieving the same data, you should used a "Page data source" web part to get all the data in one SQL call instead of 2. Then in your repeaters, point the "Data source name" property to the data source web part. Also, consider set partial caching to the data source web part as well for better performance.

Upvotes: 1

Brenden Kehren
Brenden Kehren

Reputation: 6117

Easiest thing to do is have 2 repeaters on your page template: one which shows for your listing or cms.menuitem page types and has your landing page listing transformation. And the other which shows your "selected" item transformation and only shows for your.pagetype.

Make sure to include your opening and closing tags in the content before and after and it should resolve your problem.

Upvotes: 1

Related Questions