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

Adding SpecialDays to the rad calader dinamiccally.

3 Answers 93 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Ran
Top achievements
Rank 1
Ran asked on 09 Jul 2010, 01:05 PM

I am trying to add special days dynamically, I have set the template of the special day via aspx, and I am trying to assign it the dates with code on DayRender event. Thing is, it's not happening.

The aspx code goes:

 <telerik:DayTemplate ID="DisableTemplate" runat="server">
                <Content>
                    <div class="rcTemplate rcDayDisabled">                      
                    </div>
                </Content>
            </telerik:DayTemplate>
the css:

.RadCalendar_Special .rcRow .rcDayDisabled
{
    background:0 0 no-repeat url(Disabled.gif);
}

the c#:

  protected void RadCalendar1_DayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e)
        {
            if (e.Day.Date < DateTime.Now.Date)
            {
                RadCalendarDay RadDay = new RadCalendarDay();
                RadDay.TemplateID = "DisableTemplate";
                RadDay.Date = e.Day.Date;
                e.Cell.CssClass = "rcDayDisabled";
                RadCalendar1.SpecialDays.Add(RadDay);
                }
}
also I noticed that without the property: Repeatable="DayInMonth" filled the special day will not appear... is there a solution to these problems:

3 Answers, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 13 Jul 2010, 06:57 AM
Hi Ran,

It is recommended that you add the SpecialDays in the Page_Load event handler. You can see sample code of how to achieve that in this help topic (at the bottom of the page). 

Also, would you please check if an issue occurs on your side if you set the Repeatable property to one if its other possible values?

Kind regards,
Tsvetina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ran
Top achievements
Rank 1
answered on 19 Jul 2010, 10:21 PM
Thanks for the reply, the specialDay I'm adding is every day that is prev to today, That is why I tried to add it on dayRender because it goes over every day displayed on the calander. that way the date displayed can be compared to todays date and be added to the specialDay accordingly. Is there another way to do this?
0
Tsvetina
Telerik team
answered on 21 Jul 2010, 03:01 PM
Hi Ran,

Actually, adding special days would also work in DayRender event handler, I just tested it in a sample project, which I am attaching to this post for you to view. Check what the differences are between mine and your implementation.

One option could be if the day cannot "find" the CSS style it is supposed to use. You can try declaring the style in the aspx file, as it is done in the attached project.


Regards,
Tsvetina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Calendar
Asked by
Ran
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Ran
Top achievements
Rank 1
Share this question
or