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

ShowOtherMonthsDays issue with custom special days

1 Answer 19 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
shaik Mohammed
Top achievements
Rank 1
shaik Mohammed asked on 27 Oct 2015, 04:01 PM

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

 

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 30 Oct 2015, 08:18 AM
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
Tags
DatePicker
Asked by
shaik Mohammed
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or