SpecialDay CSS Fore-Color Ignored

4 posts, 0 answers
  1. Peter
    Peter avatar
    40 posts
    Member since:
    Mar 2012

    Posted 06 Feb 2013 Link to this post

    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;   
    }

  2. Peter
    Peter avatar
    40 posts
    Member since:
    Mar 2012

    Posted 06 Feb 2013 Link to this post

    Interestingly, changing the background-color works, but not the fore-color?

    Setting calendarDay.ItemStyle.ForeColor is also completely ignored.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Peter
    Peter avatar
    40 posts
    Member since:
    Mar 2012

    Posted 06 Feb 2013 Link to this post

    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;
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 23 Jul 2013 Link to this post

    Hi Peter,

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

    Thanks,
    Princy.
Back to Top