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

SpecialDay CSS Fore-Color Ignored

3 Answers 22 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 07 Feb 2013, 04:51 AM
Why does the Rad Calendar ignore my !important fore-color?

It seems that some JavaScript code runs and overrides the style? Very frustrating!

I have the following code:

 string cssOutOfRange = "calOutOfRange";
// clear the default cell content (anchor tag) as we need to disable the hover effect for this cell
           e.Cell.Text = string.Empty;
           e.Cell.CssClass = cssOutOfRange; //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);
 
           // disable the selection for the specific day
           RadCalendarDay calendarDay = new RadCalendarDay();
           calendarDay.Date = e.Day.Date;
           calendarDay.IsSelectable = false;
           calendarDay.ItemStyle.CssClass = cssOutOfRange;
           rdpDate.Calendar.SpecialDays.Add(calendarDay);

.calOutOfRange, span.calOutOfRange {
    color: #FF0000 !important;   
}

3 Answers, 1 is accepted

Sort by
0
Peter
Top achievements
Rank 1
answered on 07 Feb 2013, 05:01 AM
Interestingly, changing the background-color works, but not the fore-color?

Setting calendarDay.ItemStyle.ForeColor is also completely ignored.
0
Peter
Top achievements
Rank 1
answered on 07 Feb 2013, 05:04 AM
Ok, so the (now obvious) fix is to realise that the cell text is removed and a new label is added (for whatever reason from the sample - something quoted as saying "necessary for the clendar skinning mechanism").

SO, you simply add the CSS class to the new label:

label.CssClass = cssOutOfRange;
0
Princy
Top achievements
Rank 1
answered on 23 Jul 2013, 10:56 AM
Hi Peter,

Please have a look into this forum thread which deals with the same requirement.

Thanks,
Princy.
Tags
Calendar
Asked by
Peter
Top achievements
Rank 1
Answers by
Peter
Top achievements
Rank 1
Princy
Top achievements
Rank 1
Share this question
or