Hi, Its worse than that, I've been trying to do the same so that I don't have
to go into every calendar if the colours change and found the follow shows
more inconcistancies :-
If anybody can see what is wrong or suggest a fix, I'd be glad too.
#### code starts
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Calendar Style Bugs ...</title>
<style type="text/css">
.cStyle
{
font-size:9pt;
background-color:white;
color:yellow;
}
.cDayHeader
{
background-color:red;
color:yellow;
}
.cNextPrev
{
background-color:blue;
color:yellow; /** BUG **/
}
.cOtherMonthDay
{
background-color:green;
color:yellow; /** BUG **/
}
.cSelectedDay
{
background-color:cyan; /** BUG **/
color:green; /** BUG **/
}
.cTitle
{
background-color:cyan;
color:yellow;
}
.cTodayDay
{
background-color:red;
color:white; /** BUG **/
}
.cWeekendDay
{
background-color:wheat;
color:red; /** BUG **/
}
.cDay
{
background-color:teal;
color:red; /** BUG **/
}
</style>
</head>
<body>
<form runat="server" action="calendarStyle.aspx">
<asp:Calendar ID="Calendar1" runat="server" Height="190px"
CssClass="cStyle"
NextPrevFormat="FullMonth" Width="250px" >
<DayHeaderStyle CssClass="cDayHeader" />
<NextPrevStyle CssClass="cNextPrev" />
<OtherMonthDayStyle CssClass="cOtherMonthDay" />
<SelectedDayStyle CssClass="cSelectedDay" />
<TitleStyle CssClass="cTitle" />
<TodayDayStyle CssClass="cTodayDay" />
<WeekendDayStyle CssClass="cWeekendDay" />
<DayStyle CssClass="cDay" />
</asp:Calendar>
</form>
</body>
</html>
#### code ends
Even using a style that works on one type on a another type ( ie using
cToday on cSelectedDay ) doesn't work, so have the gut feeling that either
the code to display both is wrong in .Net or that maybe something else is
overriding the style.
regards.
"Mark Rae" wrote:
Hi,
Has anyone found a fix for the <asp:Calendar/ CSS bug whereby certain
attributes (mainly colours) are not rendered correctly?
E.g.
<asp:Calendar ID="calTest" runat="server"
OtherMonthDayStyle-CssClass="calOtherMonthDay" />
..calOtherMonthDay
{
font-size:xx-small;
color:Green;
}
The font-size attribute works, but the color attribute doesn't, no matter
what I set it to.
Hard-coding the style attributes in-line works, but I don't want to do that
in this instance because this particular site needs to change its style
depending on the currently logged-on user, and I'm achieving that through
stylesheets.
Does anyone know if there is an easy fix for this bug? The very last thing I
want to do is to interrogate the various styles in code-behind and apply
them in the DayRender event, but I'm thinking I don't think I have many
other options...
Any assistance gratefully received.
Mark