Search code examples
kentico

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.


Solution

  • 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.