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

Setting special days through Javascript

5 Answers 95 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Nuno
Top achievements
Rank 1
Nuno asked on 19 Sep 2013, 06:38 PM
Hi,

Is there any way to set special days through Javascript? Something like a set_specialDaysArray method? I tried but couldn't get it to work.

Also, in order to add a client-side event handler to the OnDayRender event, isn't it just a matter of putting:

<ClientEvents OnDayRender="RenderADay" />

Doesn't seem to work, it doesn't trigger the event.

Thanks in advance.

Regards,
Nuno

5 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 24 Sep 2013, 12:10 PM
Hi Nuno,

I am afraid that you could not set a special days on the client. Those properties are implement for an internal use only and could not be used for setting a special days collection. I am not sure when you are expecting the OnDayRender event to be fired. Keep in mind that this event is not executed when the calendar is rendered and is called only when you navigate to a different month. Check out the following help article for additional information.

Regards,
Kostadin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Nuno
Top achievements
Rank 1
answered on 24 Sep 2013, 05:13 PM
Hi,

Thanks for the reply. So if we need to set special days dynamically, for example, based on data brought over from an external system, we should do it server-side, right? By manipulating the SpecialDays collection server-side?

Thanks,
Nuno
0
Shinu
Top achievements
Rank 2
answered on 25 Sep 2013, 07:20 AM
Hi Nuno,

If you need to add SpecialDays to a RadCalendar you can do it from server side code in the OnDayRender event. Please have a look into the sample C# code I tried which works fine at my end.

C#:
RadCalendarDay calendarDay = new RadCalendarDay();
calendarDay.Date = new DateTime(2013, 10, 22);
RadCalendar1.SpecialDays.Add(calendarDay);

Thanks,
Shinu.
0
Nuno
Top achievements
Rank 1
answered on 25 Sep 2013, 08:33 AM
Thanks Shinu.

In our case, we'll likely need to add SpecialDays in the OnLoad event, since we're bringing special days data from an external system. I guess that should work similarly, we'll give it a go.

Thanks,
Nuno
0
Kostadin
Telerik team
answered on 27 Sep 2013, 08:58 AM
Hi Nuno,

You could take a look at the last section of the following help topic which demonstrates how to add special days in Page_Load event. 

Regards,
Kostadin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Calendar
Asked by
Nuno
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Nuno
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or