RadCalendar Multiview Specific Months Background

2 posts, 0 answers
  1. Dayanithy
    Dayanithy avatar
    10 posts
    Member since:
    Jul 2011

    Posted 29 Feb 2012 Link to this post


    I am using Telerik RadControls for ASP.NET Ajax.
    DLL : Telerik.Web.UI
    Version : 2011.2.915.35 

    I have a multiview radcalendar with 6 rows and 2 columns.
    I need to highlight or change the background of a month based on the user selection in a separate combobox.

    I have two questions now,
    1. How to identify a particular month in multiview? For eg., if the user selects April 2012, how can i identify this in the calendar?
    2. How to set the background color of a particular month? For eg., if the user selects April 2012, how can i identify this in the calendar and change its background? 

    Do we have any server-side APIs to achieve this?

    PS: I have this radcalendar in an updatepanel. Triggers are set for buttons outside this updatepanel.

  2. Richard
    Richard avatar
    479 posts
    Member since:
    Nov 2011

    Posted 02 Mar 2012 Link to this post


    In order to have your RadCalendar instance display the month view based on a change of the selected date variable, you simply need to set the RadCalendar.FocusedDate property, server-side using RadCalender's PreRender event, to your selected date variable. In your case, you could use the first day of the month that is selected in your ComboBox.

    I addressed a similar request in the Display required month on RadCalender  forum thread. The difference was that the selected date was set using a RadDatePicker. Code is provided, which was a modification of the Calendar/DayRender Event online demo.

    Regarding your requirement to format the background coloring of the selected month, you can reference the above demo, which can be modified to color all days of the selected month. Also, refer to the Rad calendar multiview. Hide months views greater than RangeMaxDate for some coding assistance for this.

    Also, please note that there was a bug related to setting the FocusedDate property in your current version that was corrected in the newest Q1 2012 release. See the RadCalender section of the Release History page at http://www.telerik.com/products/aspnet-ajax/whats-new/release-history/q1-2012-beta-version-2012-1-201.aspx:

    "Fixed: When set dynamically the FocusedDate property of RadCalendar with multi month view is not applied before the next PostBack"

    Hope this helps!

Back to Top