is there a way?

2 posts, 0 answers
  1. Kevin
    Kevin avatar
    58 posts
    Member since:
    May 2009

    Posted 10 Jun 2009 Link to this post

    Hi Is there a way to diable all the days in a month on the calendar control then re-enable certain days depending on if we needed them to be re-enabled

    Many thanks
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 11 Jun 2009 Link to this post

    Hi Kevin,

    Instead of disabling all the days initially and then re-enabling certain days depending on the condition, my suggestion would be to disable all the days of the month depending on the condition.

    CS:
     
     protected void RadCalendar1_DayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e) 
        { 
            if (e.Day.Date.Month.ToString() == "6"
            { 
                DateTime SpecialDate = Convert.ToDateTime("06/11/2009"); 
                if (e.Day.Date.Date != SpecialDate) 
                { 
     
                    // disable the selection for the specific day 
                    RadCalendarDay calendarDay = new RadCalendarDay(); 
                    calendarDay.Date = e.Day.Date; 
                    calendarDay.IsSelectable = false
                    RadCalendar1.SpecialDays.Add(calendarDay); 
                } 
     
            } 
          
     
        } 


    Thanks
    Shinu
Back to Top