ShowOtherMonthsDays issue with custom special days

2 posts, 0 answers
  1. shaik Mohammed
    shaik Mohammed avatar
    12 posts
    Member since:
    Apr 2014

    Posted 27 Oct 2015 Link to this post

    Hi I'm using OnDayRender to disable special days.

    so have added below code

     

    <telerik:RadDatePicker Calendar-DayNameFormat="Shortest" Calendar-ShowOtherMonthsDays="false" DateInput-ReadOnly="true" DatePopupButton-ImageUrl="/images/calander_icon.gif" DatePopupButton-HoverImageUrl="/images/calander_icon.gif"
                                                                      ID="rdpDeliveryDate" OnLoad="rdpDeliveryDate_Load"  runat="server" >
                                                                     <Calendar ID="Calendar1" runat="server" ShowRowHeaders="false"  OnDayRender="dayRender"  ShowFastNavigationButtons="false" FirstDayOfWeek="Sunday"></Calendar>
                                                                 </telerik:RadDatePicker>

    CS:

     

    protected void dayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e)
            {
      
    if (e.Day.Date.DayOfWeek == DayOfWeek.Friday|| e.Day.Date.DayOfWeek == DayOfWeek.Saturday)
            {
                            // clear the default cell content (anchor tag) as we need to disable the hover effect for this cell
                            e.Cell.Text = "";
                            e.Cell.CssClass = "rcOutOfRange"; //set new CssClass for the disabled calendar day cells (e.g. look like other month days here)
      
                            // render a span element with the processed calendar day number instead of the removed anchor -- necessary for the calendar skinning mechanism
                            Label label = new Label();
                            label.Text = e.Day.Date.Day.ToString();
                            e.Cell.Controls.Add(label);
                            e.Cell.ToolTip = "Day Off";
      
                            RadCalendarDay dayoff = new RadCalendarDay();
                            dayoff.Date = e.Day.Date;
                            dayoff.IsSelectable = false;
                            dayoff.IsDisabled = true;
                            dayoff.ItemStyle.CssClass = "rcOutOfRange";
      
                            cln.SpecialDays.Add(dayoff);
                              
                        }
    }

    I'm using  Version 2015.2.826.45,
    Visual studio 2012.

    but still other month of special days showing in the calendar. please check the attached screen shot

     

    appropriate for quick and best response.

     

    Yasin

     

  2. Eyup
    Admin
    Eyup avatar
    3009 posts

    Posted 30 Oct 2015 Link to this post

    Hi Yasin,

    Please check the samples provided in the following post and let me know about the result on your side:
    http://www.telerik.com/forums/calendar-questions#rk4_SG3ajUODfE-WKdhx2Q

    Regards,
    Eyup
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top