CMSRepeater Layout?!

Tom F asked on November 29, 2016 07:48

Hi All, I'm playing with Kentico for the first time and trying to get a cms repeater to work.

I'm trying to use a custom layout and try as I might I can't get it working as I think it should. In my web part properties I've created a new layout and put the following code in:

<%@ Control Language="C#" AutoEventWireup="true" Inherits="CMSWebParts_Viewers_Documents_cmsrepeater"  Codebehind="~/CMSWebParts/Viewers/Documents/cmsrepeater.ascx.cs" %>

<cms:CMSEditModeButtonAdd ID="btnAdd" runat="server" Visible="False" />
<cms:CMSRepeater ID="PointOfDifferentRepeater" runat="server">
  <%-- CMSRepeater template ----------------------------------------------------------- --%>
        <%# (Container.ItemIndex + 4) % 4 == 0 ? "<div class=\"row" + (Container.ItemIndex == 0 ? " first-point-of-difference-row\"" : " nth-point-of-difference-row\"") + ">" : string.Empty %>
        <div class="col-lg-3 col-md-12 col-sm-12 col-xs-12 point-of-difference-container">
            <%# GetImage("Image") %>
            <%# Eval("Title") %>
            <%# Eval("Description") %>
        <%# (Container.ItemIndex + 4) % 4 == 3 ? "</div>" : string.Empty %>
  <%-- CMSRepeater template ----------------------------------------------------------- --%>

Any chance someone could take a look and let me know what's wrong with the layout?

Thanks for your time

Recent Answers

Adam Gitin answered on November 29, 2016 08:50

Hi Tom,

You say custom layout so I assume you are using the portal engine and not aspx templates.

In any case you should use transformations for the layout of repeating data and can use the webpart HTML ENVELOPE property for wrapping layout.

IS your repeater showing any data? is the layout the only issue?

0 votesVote for this answer Mark as a Correct answer

Roman Hutnyk answered on November 29, 2016 10:19

Do not change the layout of the repeater web part (unless it is required).

You need to configure you repeater: specify what data or page type you want to show, where should repeater take this data from, etc. There are different types of repeaters or viewers to show data: repeater with qustom query, bacis repeater, etc. You can either specify what/where to take data from or use datasource for it.

You can find more information about loading data here.

Also you'll need to implement and specify transformation.

0 votesVote for this answer Mark as a Correct answer

Khoa Ovaner answered on November 29, 2016 10:53

If you want to custom layout for repeater, i recommend you using transformation for easy to wrap your layout

0 votesVote for this answer Mark as a Correct answer

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