Adding SpecialDays to the rad calader dinamiccally.

4 posts, 0 answers
  1. Ran
    Ran avatar
    6 posts
    Member since:
    Oct 2008

    Posted 09 Jul 2010 Link to this post

    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:

  2. Tsvetina
    Admin
    Tsvetina avatar
    2481 posts

    Posted 13 Jul 2010 Link to this post

    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
  3. Ran
    Ran avatar
    6 posts
    Member since:
    Oct 2008

    Posted 19 Jul 2010 Link to this post

    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?
  4. Tsvetina
    Admin
    Tsvetina avatar
    2481 posts

    Posted 21 Jul 2010 Link to this post

    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
Back to Top