Problem setting style of a calendar control via stylesheet

Discussion in 'ASP .Net Web Controls' started by Martin Bischoff, Mar 9, 2005.

  1. Hi, I have a problem setting the style of a calendar control using style sheets.

    Example: I have set the calendar control's property TodayDayStyle-CssClass to
    "today". In my .css I have:

    ..today
    {
    color: Red;
    background-color: Yellow;
    }

    The calendar control will render today's day with a yellow background, but it
    ignores the red foreground-color.

    When I look at the generated html code in the browser, I can see the following
    (this is the <TD> for today):

    <td class="today" align="Center" style="width:14%;"><a
    href="javascript:__doPostBack('Calendar1$Calendar1','1836')"
    style="color:Black">10</a></td>


    The <a> tag has it's color set to Black. I did not set this anywhere, neither
    in the control's properties, nor in the .css.

    Is there any way to stop the calendar control from writing this "color:Black"
    so that the definitions from the css are used?


    Thanks,
    Martin
    Martin Bischoff, Mar 9, 2005
    #1
    1. Advertising

  2. Hi Martin,

    Welcome to ASPNET newsgroup. From your description, you're trying to apply
    an css style for the ASP.NET , but find that the forecolor style you apply
    on the Today CEll always not work(replaced by an existing "color:black"
    style in the <a> link , yes?

    As for this problem, I'm afraid it is an exsiting problem of the ASP.NET
    Calendar control. And the default
    "color:black" style is infact hardcoded in the Caleandar control's code.
    That's why you can not found any settings in the Calendar's Style Template.
    I've also seen many other ones discussing on this problem in many public
    formus. Unfortunately, we haven't an good means to gracefully resolve it
    currently.

    Some developers have tried overriding the Render method of the Calendar
    control (provide their custom Calendar control dervied from the Buildin one)

    here are some related tech articles:

    #BetterCalendar WebControl
    http://www.codeproject.com/aspnet/BetterCalendar.asp

    #Calendar buggy styles, and the OOP fix!
    http://weblogs.asp.net/cazzu/archive/2004/02/02/66130.aspx

    HTH. Also, I'm sorry for the inconvenience the problems bring you.


    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
    Steven Cheng[MSFT], Mar 10, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Martin Bischoff
    Replies:
    0
    Views:
    362
    Martin Bischoff
    Jan 12, 2005
  2. =?ISO-8859-1?Q?J=F8rn_Tommy_Kinder=E5s?=

    Stylesheet referanse i stylesheet

    =?ISO-8859-1?Q?J=F8rn_Tommy_Kinder=E5s?=, Jul 3, 2004, in forum: XML
    Replies:
    3
    Views:
    563
    =?ISO-8859-1?Q?J=F8rn_Tommy_Kinder=E5s?=
    Jul 4, 2004
  3. Steven An
    Replies:
    1
    Views:
    492
    Martin Honnen
    Nov 23, 2004
  4. Martin Bischoff

    Problem setting style of a calendar control via stylesheet

    Martin Bischoff, Jan 10, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    100
    Martin Bischoff
    Jan 10, 2005
  5. Martin Bischoff

    Problem setting style of a calendar control via stylesheet

    Martin Bischoff, Mar 4, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    109
    Martin Bischoff
    Mar 4, 2005
Loading...

Share This Page