Setting special days through Javascript

6 posts, 0 answers
  1. Nuno
    Nuno avatar
    3 posts
    Member since:
    Sep 2013

    Posted 19 Sep 2013 Link to this post

    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
  2. Kostadin
    Admin
    Kostadin avatar
    1708 posts

    Posted 24 Sep 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Nuno
    Nuno avatar
    3 posts
    Member since:
    Sep 2013

    Posted 24 Sep 2013 Link to this post

    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
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 25 Sep 2013 Link to this post

    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.
  6. Nuno
    Nuno avatar
    3 posts
    Member since:
    Sep 2013

    Posted 25 Sep 2013 Link to this post

    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
  7. Kostadin
    Admin
    Kostadin avatar
    1708 posts

    Posted 27 Sep 2013 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017