EventRepeater to mirror the Event Calendar view

Jordan Howard asked on November 2, 2016 16:02

I am using both the event calendar and event repeater on a single page to give employees an overview as to what each event listed in the calendar is about.

With the event caledar you can view this per month, but the repeater appears to always show all events. What I'd like the repeater to do is only show the events listed in the calendar view above.

i.e. if you're looking at November in the calendar, only the November dates are shown in the repeater below.

Is this possible? I can't find an option to make this happen.

Cheers in advance

Recent Answers

Trevor Fayas answered on November 2, 2016 17:13

A couple options that i can think of. First, if you can create your own "month" navigation that creates a URL parameter (say ?date=201602), then you can have the calendar display events within that month via macros and the WHERE condition, and use the same macro to modify your repeater.

Or you would possibly have to clone the Calendar webpart and have it set a macro in the API that the other tool can grab (see the MacroContext class). If you need to do this, i can try to provide more code.

0 votesVote for this answer Mark as a Correct answer

Jordan Howard answered on November 3, 2016 10:23

Thanks for the info. Unfortunately I don't know enough about Kentico to even attempt what you've suggested!

Is there any chance this can be broken down into instuctions a complete noob could follow?

Otherwise, I'll pass this onto one of our developers to resolve. I justed wanted to see if it was something I could do myself first.



0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on November 3, 2016 15:55 (last edited on December 10, 2019 02:30)

I'll do the best I can!

  1. You'll need to create a "Month" drop down, this can be a Static Text web part and just manually created, or use macros to make it where it keeps updating.
  2. Add some javascript that on the drop down change, go to the current page with the month selected in ?date=201601
  3. On the Event Calendar AND the repeater of the events below it, there should be a "Where" condition, set it to something like this "(month(EventDate) = month('{% (string.isnullorwhitespace(date) ? "201601" : date) |(identity)GlobalAdministrator%}01') or ({? (string.isnullorwhitespace(date) ? "1=1" : "1=0" ) and month(EventDate) = month(GETDATE())"

To explain the SQL, the first part will match events that match the "date" URL parameter's month, the second part is if there is no date parameter, it will show the events that have the current month's month.

0 votesVote for this answer Mark as a Correct answer

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