ASPX templates
Version 4.x > ASPX templates > Using WhereCondition in CMSRepeater with Calendar View modes: 
User avatar
Member
Member
camarotta-optonline - 7/22/2009 11:01:10 AM
   
Using WhereCondition in CMSRepeater with Calendar
Hi, I just started using Kentico and I'm trying to modify the calendar control to coordinate with the cmsrepeater so when a user clicks a date (I have that working), the details of the events are displayed below.

I want to extract the events by month in the detail repeater. I have the cmsrepeater almost working but I can't get the right month.

I tried this code:

<cms:CMSRepeater ID="repEvent" runat="server" OrderBy="EventDate" classnames="cms.event" TransformationName="CMS.Event.TestEventPreview" Path="/%" DelayedLoading="true" WhereCondition="Month(EventDate)=<%=VisibleMonth()%>/>

and

<cms:CMSRepeater ID="repEvent" runat="server" OrderBy="EventDate" classnames="cms.event" TransformationName="CMS.Event.TestEventPreview" Path="/%" DelayedLoading="true" WhereCondition="Month(EventDate)=<%#VisibleMonth()%>/>

But this just bombs in code because it doesn't process the server tags.

Then I tried setting in code behind:

repEvent.WhereCondition="Month(EventDate)=" + VisibleDate.Month;

But it's not coordinated, the visible date is always the prior selected month by the time I get here.

Can you help please?

Thanks!
Carol

User avatar
Member
Member
camarotta-optonline - 7/22/2009 5:38:45 PM
   
RE:Using WhereCondition in CMSRepeater with Calendar
I was able to fix the problem this way:

in aspx:

<%ReloadData();%>
<div class="EventDetail" >
<cms:CMSRepeater ID="repEvent" runat="server" Path="/%" />
</div>

in code behind:

protected void ReloadData()
{
repEvent.ClassNames="cms.event";
repEvent.TransformationName="CMS.Event.TestEventPreview";
repEvent.OrderBy="EventDate";
this.repEvent.WhereCondition= "Month(EventDate)=" + SelectedMonth();
this.repEvent.ReloadData(true);
}