You can use the OnFilter event. This code removes every event that doesn't come from the users chosen department or the sites main calendar.
<EPiServer:Calendar ID="CalendarList" PageTypeID="28" runat="server" NumberOfDaysToRender="360" ExpandAllDays="false" OnFilter="FilerEvents">
Code behind:
protected void FilerEvents(object sender, EPiServer.Filters.FilterEventArgs e)
{
PageDataCollection Pages = e.Pages;
PageData MainCalender= GetPage((PageReference)StartPage["ShowCalendarFrom"]);
for (int i = 0; i < Pages.Count; i++)
{
PageData iPage = Pages[i];
if (iPage.ParentLink != MyDepartment.PageLink&&iPage.ParentLink!=MainCalender.PageLink)
{
Pages.RemoveAt(i);
i--;
}
}
}
Thanks very much.
I would like to know what is "MyDepartment" in the above code?
MyDepartment is a PageData object that I set to the calendarpage that my users have chosen.
How do we perform a filterring inside the control.
For eg. I have certain offices in my drop down and want to show only events that are going to take place at a particular selected office.
Thanks in Advance.