Calendar with more than +/- 5 years

   —   
If you use date/time fields in the document type or BizForm (with Calendar field type) you can see a textbox with calendar icon and Now link. When you click on Calendar the pop-up window appears where you can select years from dropdown list. By default, the current year is selected and then +/- 5 years. This article explains how you can extend the year selection.
Please open this file:  ~\CMSAdminControls\Calendar\Calendar.ascx.cs

There is the SetTime method and the code line (about 261):

FillNumbers(this.drpYear, cultureYearInt - 5, cultureYearInt + 5, time.Year - 5);


You can change the code here. For example if you want to display years between now and (now-100) you can change the code like this:

FillNumbers(this.drpYear, cultureYearInt - 100, cultureYearInt, time.Year - 100);


It fills the dropdownlist with 100 years. However, you can browse by left and right arrows through any month (of any year).

Please note that this file gets used for all calendars in Kentico system. If you want a special calendar please develop a custom form control.

-hg-


See also: Developing custom form controls

Applies to: Kentico CMS 5.0
Share this article on   LinkedIn

Juraj Ondrus

Hi, I am the Technical support leader at Kentico. I'm here to help you use Kentico and get as much as possible out of it.