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

Font Color of the Calendar

6 Answers 158 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Cloud
Top achievements
Rank 1
Cloud asked on 03 Nov 2008, 11:00 AM
Hi all,

  I want to set the font color to red when the date is holiday. The skin i am using is Outlook. But when I set the Forecolor of a SpecialDay to red, it is still showing black to me. Anyone can help. Thx so much.

6 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 03 Nov 2008, 11:23 AM
Hello Cloud,

The color is set to the Calendar table cell, but the hypelink inside that cell does not inherit this color style (browser behavior).

Please set a custom CSS class to the table cell and then use the following CSS rule:


.RadCalendar_Outlook  td.MyCustomCellClass  a
{
     color: red;
}


Best wishes,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Cloud
Top achievements
Rank 1
answered on 04 Nov 2008, 01:33 AM
Hi Dimo

  I can't make it work, could you please provide me some sample code?
  Thx.

Regards,
Cloud
0
Dimo
Telerik team
answered on 04 Nov 2008, 08:01 AM
Hi Cloud,

Sorry, I have provided a CSS selector, which will work with Q3 2008 Beta, while you can be using an older version.

Please try this:

ASPX

<telerik:RadCalendar ID="RadCalendar1" runat="server" Skin="Outlook">
    <SpecialDays>
        <telerik:RadCalendarDay Date="2008/11/04" ItemStyle-CssClass="MyClass" />
    </SpecialDays>
</telerik:RadCalendar>


CSS

.calendarWrapper_Outlook  .MyClass  a
{
   color: red;
}


However, if you upgrade to Q3 2008, you will need to use the CSS selector provided in my earlier message.


Best wishes,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Accepted
Shinu
Top achievements
Rank 2
answered on 04 Nov 2008, 08:29 AM
Hi Cloud,

You can try the following code snippet to assign the css class to the desired date in the code behind.

CSS
<style type="text/css" > 
     .CustomClass a 
     { 
      color:Red !Important; 
     } 
</style> 

C#
protected void RadCalendar1_DayRender(object sender, Telerik.Web.UI.Calendar.DayRenderEventArgs e) 
    { 
        if (e.Day.Date == Convert.ToDateTime("11/04/2008 12:00:00 AM")) 
        { 
            e.Cell.CssClass = "CustomClass"
        } 
    } 


Thanks,
Shinu.
0
Cloud
Top achievements
Rank 1
answered on 04 Nov 2008, 09:15 AM
Hi all,

  I get it works finally. The Important keyword plays the trick.
Thank you so much.

Regards,
Cloud
0
Princy
Top achievements
Rank 2
answered on 05 Nov 2008, 04:49 AM

Hi Cloud,

Adding to the above post, since the skin definitions will override any additional css classes for the calendar, you will need to put an !important keyword to the calendar styles in order to take precedence over the calendar rendering. Thus the corresponding appearance setting will dominate over the style specified in the Styles.css file of the chosen skin.

Thanks,
Princy.

Tags
Calendar
Asked by
Cloud
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Cloud
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Princy
Top achievements
Rank 2
Share this question
or