This is a migrated thread and some comments may be shown as answers.

RadCalendar Multiview Specific Months Background

1 Answer 133 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Dayanithy
Top achievements
Rank 1
Dayanithy asked on 29 Feb 2012, 05:46 PM
Hi,

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.

Regards,
Dayantihy

1 Answer, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 02 Mar 2012, 06:00 PM
Dayanity:

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!


Tags
Calendar
Asked by
Dayanithy
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Share this question
or