Calendar control and CSS - bugged or what?

Last post 08-09-2007 2:10 PM by CRLord. 4 replies.

Sort Posts:

  • Calendar control and CSS - bugged or what?

    11-09-2003, 2:01 PM
    • Loading...
    • Sharbel_
    • Joined on 11-12-2002, 8:02 AM
    • Windsor, Ontario
    • Posts 1,174
    I Google'd and searched this forum and there have been a few questions about this, with no response at all.

    Is the calendar control bugged? It will not take color: CSS info for any of the A tags on my calendar.

    The only way is if I set the Forecolor property, which is something I can't do because the calendar is part of a portal app... thousands of users have different styles applied to that calendar control (css_id is pulled from database on the fly).

    I really don't want to be parsing strings to find the color and setting the forecolor on the PageLoad, but it seems I have to?
  • Re: Calendar control and CSS - bugged or what?

    02-14-2005, 4:51 AM
    • Loading...
    • alfisti
    • Joined on 02-14-2005, 4:30 AM
    • Posts 1
    It seems that way...

    I have made a calendar control with defined CSS classes.
    Some of them works fine.
    Others, like "WeekendDayStyle", doesnt work all the way.

    When I look at the HTML output I find that the "<TD> tag has --- style="color:Black" --- even though I have not set that property.
    This overrides my CSS color property.

    This must be a bug.

    Same problem with "SelectedDayStyle". But here I also get ---
    style="color:White;background-color:Silver ---
    so I cant set those properties either.

    Anyone who knows of a workaround? (I'm new to C#, it might be obvious)
  • Re: Calendar control and CSS - bugged or what?

    02-14-2005, 4:58 AM
    • Loading...
    • SomeNewKid
    • Joined on 08-10-2003, 12:16 AM
    • Western Australia
    • Posts 8,027
    CSS is extremely sensitive to a thing called specificity. Without knowing about specificity, it can appear that CSS definitions are simply not working.

    Can you show the code for your calendar control, plus all its ancestor controls up to the server <form> level?

    I'm sure we can then get your CSS definitions right.
    Alister
  • Re: Calendar control and CSS - bugged or what?

    02-14-2005, 6:31 PM
    • Loading...
    • Sharbel_
    • Joined on 11-12-2002, 8:02 AM
    • Windsor, Ontario
    • Posts 1,174
    CSS issues with the calendar control is very well known and documented.. There are some work arounds that I saw which involves creating a new calendar control that inherits from the base one and overrides the render method.

    Do a google search, I am sure you will find the work around(s)
  • Re: Calendar control and CSS - bugged or what?

    08-09-2007, 2:10 PM
    • Loading...
    • CRLord
    • Joined on 11-08-2006, 9:24 AM
    • Posts 66

    I know this post is kind of old, but if anyone else is still looking for a solution to the calendar CSS bug here it is. I noticed the issue with the ForeColor propoerty of the OtherMonthDayStyle tag. If I used a CssClass it would override it and give the <a> tag style with the color as black. It is stupid to force a ForeColor attribute in the control. Anyway the solution is as follows.

    .calendarOtherMonthDay, .calendarOtherMonthDay a, td.calendarOtherMonthDay
    {
             color:#808080 !important;
    }

    Adding !important forces the chage to be made. Also note that with thte calendar control the actual text for dates and other items are actually wrapped in other tags such as <td> or <a> so you may have to specify those in your CSS as I did here. Hope this helps someone. Took we a while to find the solution for my calendar. Needless to say I was very frustrated for a very long time.

Page 1 of 1 (5 items)
Microsoft Communities
Page view counter