Class Calendar
Displays a template based calendar where the calendar events are pages in EPiServer.
Implements
Inherited Members
Namespace: EPiServer.Web.WebControls
Assembly: EPiServer.Web.WebControls.dll
Version: 10.10.4Syntax
public class Calendar : PageControlBase, IEnumerable, IPageSource, INotifyPropertyChanged, IPageControl, INamingContainer
Remarks
Pages that will serve as events must at least have properties "EventStartDate" and "EventStopDate"
<episerver:calendar pagelinkproperty="CalendarContainer" runat="server" id="Calendar1">
<DayPrefixTemplate>
<%#Container.DayName%>, <%#Container.DayOfMonth%> <%#Container.MonthName%>
</DayPrefixTemplate>
<EventTemplate>
<episerver:property PropertyName="PageLink" runat="server"/>
</EventTemplate>
</episerver:calendar>
Constructors
Calendar()
Initializes a new instance of Calendar
Declaration
public Calendar()
Properties
ActiveSelectedDates
A collection of the dates with events on for the selected period.
Declaration
public List<DateTime> ActiveSelectedDates { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<System.DateTime> |
BeginDate
Date of first day displayed in Calender. Is not used if SelectedDates is specified.
Declaration
public DateTime BeginDate { get; set; }
Property Value
Type | Description |
---|---|
System.DateTime |
Remarks
Default value is set to System.DateTime.Today.
DayPrefixTemplate
Template for day prefix.
Declaration
public ITemplate DayPrefixTemplate { get; set; }
Property Value
Type | Description |
---|---|
System.Web.UI.ITemplate |
DaySuffixTemplate
Template for day suffix.
Declaration
public ITemplate DaySuffixTemplate { get; set; }
Property Value
Type | Description |
---|---|
System.Web.UI.ITemplate |
EnableVisibleInMenu
Gets or sets whether the calendar should filter page based on the "Visible in menu" property.
Declaration
public bool EnableVisibleInMenu { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
EventTemplate
Template for events in the calendar.
Declaration
public ITemplate EventTemplate { get; set; }
Property Value
Type | Description |
---|---|
System.Web.UI.ITemplate |
ExpandAllDays
Shows all days even if there are no events on this day.
Declaration
public bool ExpandAllDays { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
Default value is true.
IgnoreInvalidPages
If pages that does not qualify as calendar pages should be ignored.
Declaration
public bool IgnoreInvalidPages { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | Default value is false. |
MaxCount
Set value to limit the amount of events that are rendered.
Declaration
public int MaxCount { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
Default value is -1
NumberOfDaysToRender
Number of days to display at a time in the Calender.
Declaration
public int NumberOfDaysToRender { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
Default value is 7
PageTypeID
Restrict events to the following PageTypeID.
Declaration
public int PageTypeID { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
By default no page type restriction is applied
ReverseDateSortOrder
If the dates for the calendar should be shown in reverse order. Default value is false.
Declaration
public bool ReverseDateSortOrder { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Remarks
The events for each day will still be sorted normally.
SelectedDates
A collection of dates to be rendered. The control will render all dates from the first date in the collection to the last date.
Declaration
public SelectedDatesCollection SelectedDates { get; set; }
Property Value
Type | Description |
---|---|
System.Web.UI.WebControls.SelectedDatesCollection |
Remarks
The Collection should be sorted by Date.
Methods
AddActiveDate(DateTime)
Declaration
protected void AddActiveDate(DateTime activeDate)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | activeDate |
CreateChildControls()
Declaration
protected override void CreateChildControls()
CreateDayPrefix(DateTime)
Create day prefix template for date
Declaration
protected virtual void CreateDayPrefix(DateTime nowDate)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | nowDate | The date to created template for |
CreateDaySuffix(DateTime)
Created day suffix template for day
Declaration
protected virtual void CreateDaySuffix(DateTime nowDate)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | nowDate | The date to create template for |
CreateEventTemplate(PageData, DateTime)
Create template for a calendar event
Declaration
protected virtual void CreateEventTemplate(PageData page, DateTime currentDate)
Parameters
Type | Name | Description |
---|---|---|
PageData | page | The page to created a event template for |
System.DateTime | currentDate | Current date that page should be visibly on |
CreatePostSortFilters()
Declaration
protected override void CreatePostSortFilters()
Overrides
CreatePreSortFilters()
Declaration
protected override void CreatePreSortFilters()
Overrides
CreateSortFilters()
Declaration
protected override void CreateSortFilters()
Overrides
DateIsActive(DateTime)
Is this method to check if a date has active events in it.
Declaration
public bool DateIsActive(DateTime activeDate)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | activeDate | The date to compare with the event. |
Returns
Type | Description |
---|---|
System.Boolean | True if there is an event on the date. |
Remarks
The date must be set to be rendered by the control.
GetDayNumber(Int32)
Declaration
protected Calendar.Days GetDayNumber(int day)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | day |
Returns
Type | Description |
---|---|
Calendar.Days |
IsEventRecurring(PageData, Calendar.Days)
Check if event is recurring
Declaration
protected virtual bool IsEventRecurring(PageData pageData, Calendar.Days day)
Parameters
Type | Name | Description |
---|---|---|
PageData | pageData | The page to check |
Calendar.Days | day | The day to check |
Returns
Type | Description |
---|---|
System.Boolean | If event was recurring the specified day |
PopulatePages(PageDataCollection)
Declaration
protected override void PopulatePages(PageDataCollection pages)
Parameters
Type | Name | Description |
---|---|---|
PageDataCollection | pages |
Overrides
SetCalendarInterval()
Set begin and stop dates. Called when Calendar is about to create child controls.
Declaration
protected virtual void SetCalendarInterval()