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

RadCalendar alternate styles of .rcMain .rcRow a, .RadCalendar_Silk .rcMain .rcRow span

3 Answers 31 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Marco
Top achievements
Rank 1
Marco asked on 12 Sep 2014, 10:14 AM
Hello, I have a problem that is as follows, I am using a calendar but I want it to appear in different configurations depending on an earlier choice. For example if the option is one I want to show the calendar with the days of the week black and weekends ash if the option is 2 I want the weekends are the black and the gray days of the week.

For the 1st option happens altered :

 .RadCalendar_Silk .rcMain .rcWeekend a {
                    color:#C2BABA;
                }

but then I can not change to black when the 2nd option is chosen.

Anyone have any idea how to do this?

Thanks You

3 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 17 Sep 2014, 10:56 AM
Hello Marco,

Note that changing the Calendar styles dynamically could lead to various issues depending on your specific configuration. Therefore I would suggest you as a better option in your case, to use several calendars on the page with initially defined styles and simply manipulate their visibility based on the chosen option.

Regards,
Maria Ilieva
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Marco
Top achievements
Rank 1
answered on 17 Sep 2014, 11:04 AM
Ok, thanks.

I have another problem

          if (isHoliday)    
                      {
                          calendarDay.IsSelectable = false;
                          calendarDay.ToolTip = eventString;
                          calendarDay.TemplateID = "Silk";
                          calendarDay.ItemStyle.CssClass = "Holiday";
                      }
                      else
                      {
                         calendarDay.IsSelectable = true;
                         calendarDay.ToolTip = eventString;
                         calendarDay.TemplateID = "Silk"; 
                         calendarDay.ItemStyle.CssClass = "Holiday";
                      }

when the code enter in else the "calendarDay.IsSelectable = true" not working and if i remove the "calendarDay.TemplateID = "Silk";" it works but the cell not use template = Silk. Why  "calendarDay.IsSelectable = true" not working?

In the case of 

    if (isHoliday)    
                      {
                          calendarDay.IsSelectable = false;
                          calendarDay.ToolTip = eventString;
                          calendarDay.TemplateID = "Silk";
                          calendarDay.ItemStyle.CssClass = "Holiday";
                      }

works fine.

Thanks
0
Kostadin
Telerik team
answered on 22 Sep 2014, 10:52 AM
Hello Marco,

Note that IsSelected actually does not select the date and only apply the css class of the date. In order to select the date you could use the following approach.
else
{
   calendarDay.IsSelectable = true;
   calendarDay.ToolTip = eventString;
   calendarDay.TemplateID = "Silk";
   calendarDay.ItemStyle.CssClass = "Holiday";
   RadCalendar1.SelectedDate = calendarDay.Date;
}

Regards,
Kostadin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Calendar
Asked by
Marco
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Marco
Top achievements
Rank 1
Kostadin
Telerik team
Share this question
or