Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Applying CSS to Calendar

Reply
Thread Tools

Applying CSS to Calendar

 
 
MattC
Guest
Posts: n/a
 
      08-11-2004
I am having trouble setting the color of the numbers in a calender control,
here's what i am using, also the background in title is silver as is the
selected day not matter what color I set the background-color to, I think
this si due to the fact taht the css is applyed to the Table and the
subsequest TD gets set to silver.

My CSS is simply at best how can i set the background-color and links color
of nested elements, I have tried things like:

table.calendartitle td{}, or .calendardays a, but I'm not sure of the
syntax.

..calendar
{
border-right:solid 1px #6699CC;
border-bottom:solid 1px #6699CC;
border-top:solid 1px #1b5086;
border-left:solid 1px #1b5086;
}

..calendartitle
{
font-size:14px;
color:WhiteSmoke;

FILTERrogidXImageTransform.Microsoft.Gradient( endColorstr='#1b5086',star
tColorstr='#4e82b9', gradientType='0');
BORDER-BOTTOM: #1b5086 1px solid;
BORDER-TOP: #6699CC 1px solid;
background-color: #4e82b9;
}

..calendarheader
{
font-weight:bold;
background-color: #1b5086;
color:WhiteSmoke;
border: solid 1px Whitesmoke;
}

..calendardays
{
background-color: #4e82b9;
color:WhiteSmoke;
border: solid 1px #1b5086;
}

..calendarselected
{
background-color: WhiteSmoke;
color: #4e82b9;
border: solid 1px #1b5086;
}

<asp:Calendar id="_dateselector" runat="server" CssClass="calendar"
DayNameFormat="Full">
<DayStyle CssClass="calendardays"></DayStyle>
<DayHeaderStyle CssClass="calendarheader"></DayHeaderStyle>
<SelectedDayStyle CssClass="calendarselected"></SelectedDayStyle>
<TitleStyle CssClass="calendartitle"></TitleStyle>
</asp:Calendar>


 
Reply With Quote
 
 
 
 
Scott M.
Guest
Posts: n/a
 
      08-11-2004
Don't use CSS at all. Instead use the many many design-time properties that
a calendar control has for just this purpose:

Calendar.DayStyle.ForeColor = color.YourColor
Calendar.BackColor = Color.YourColor
etc.


"MattC" <> wrote in message
news:...
> I am having trouble setting the color of the numbers in a calender

control,
> here's what i am using, also the background in title is silver as is the
> selected day not matter what color I set the background-color to, I think
> this si due to the fact taht the css is applyed to the Table and the
> subsequest TD gets set to silver.
>
> My CSS is simply at best how can i set the background-color and links

color
> of nested elements, I have tried things like:
>
> table.calendartitle td{}, or .calendardays a, but I'm not sure of the
> syntax.
>
> .calendar
> {
> border-right:solid 1px #6699CC;
> border-bottom:solid 1px #6699CC;
> border-top:solid 1px #1b5086;
> border-left:solid 1px #1b5086;
> }
>
> .calendartitle
> {
> font-size:14px;
> color:WhiteSmoke;
>
>

FILTERrogidXImageTransform.Microsoft.Gradient( endColorstr='#1b5086',star
> tColorstr='#4e82b9', gradientType='0');
> BORDER-BOTTOM: #1b5086 1px solid;
> BORDER-TOP: #6699CC 1px solid;
> background-color: #4e82b9;
> }
>
> .calendarheader
> {
> font-weight:bold;
> background-color: #1b5086;
> color:WhiteSmoke;
> border: solid 1px Whitesmoke;
> }
>
> .calendardays
> {
> background-color: #4e82b9;
> color:WhiteSmoke;
> border: solid 1px #1b5086;
> }
>
> .calendarselected
> {
> background-color: WhiteSmoke;
> color: #4e82b9;
> border: solid 1px #1b5086;
> }
>
> <asp:Calendar id="_dateselector" runat="server" CssClass="calendar"
> DayNameFormat="Full">
> <DayStyle CssClass="calendardays"></DayStyle>
> <DayHeaderStyle CssClass="calendarheader"></DayHeaderStyle>
> <SelectedDayStyle CssClass="calendarselected"></SelectedDayStyle>
> <TitleStyle CssClass="calendartitle"></TitleStyle>
> </asp:Calendar>
>
>



 
Reply With Quote
 
 
 
 
MattC
Guest
Posts: n/a
 
      08-11-2004
My only problem with that is that i dont want to have to recompile my code
to change the background color of a calendar, let alone edit each of the
calendars one by one. I would rather upload a new master style sheet and
hey presto new website wide color schemes.

MattC

"Scott M." <s-> wrote in message
news:...

> Don't use CSS at all. Instead use the many many design-time properties

that
> a calendar control has for just this purpose:
>
> Calendar.DayStyle.ForeColor = color.YourColor
> Calendar.BackColor = Color.YourColor
> etc.
>
>
> "MattC" <> wrote in message
> news:...
> > I am having trouble setting the color of the numbers in a calender

> control,
> > here's what i am using, also the background in title is silver as is the
> > selected day not matter what color I set the background-color to, I

think
> > this si due to the fact taht the css is applyed to the Table and the
> > subsequest TD gets set to silver.
> >
> > My CSS is simply at best how can i set the background-color and links

> color
> > of nested elements, I have tried things like:
> >
> > table.calendartitle td{}, or .calendardays a, but I'm not sure of the
> > syntax.
> >
> > .calendar
> > {
> > border-right:solid 1px #6699CC;
> > border-bottom:solid 1px #6699CC;
> > border-top:solid 1px #1b5086;
> > border-left:solid 1px #1b5086;
> > }
> >
> > .calendartitle
> > {
> > font-size:14px;
> > color:WhiteSmoke;
> >
> >

>

FILTERrogidXImageTransform.Microsoft.Gradient( endColorstr='#1b5086',star
> > tColorstr='#4e82b9', gradientType='0');
> > BORDER-BOTTOM: #1b5086 1px solid;
> > BORDER-TOP: #6699CC 1px solid;
> > background-color: #4e82b9;
> > }
> >
> > .calendarheader
> > {
> > font-weight:bold;
> > background-color: #1b5086;
> > color:WhiteSmoke;
> > border: solid 1px Whitesmoke;
> > }
> >
> > .calendardays
> > {
> > background-color: #4e82b9;
> > color:WhiteSmoke;
> > border: solid 1px #1b5086;
> > }
> >
> > .calendarselected
> > {
> > background-color: WhiteSmoke;
> > color: #4e82b9;
> > border: solid 1px #1b5086;
> > }
> >
> > <asp:Calendar id="_dateselector" runat="server" CssClass="calendar"
> > DayNameFormat="Full">
> > <DayStyle CssClass="calendardays"></DayStyle>
> > <DayHeaderStyle CssClass="calendarheader"></DayHeaderStyle>
> > <SelectedDayStyle CssClass="calendarselected"></SelectedDayStyle>
> > <TitleStyle CssClass="calendartitle"></TitleStyle>
> > </asp:Calendar>
> >
> >

>
>



 
Reply With Quote
 
Scott G.
Guest
Posts: n/a
 
      08-11-2004

The reason you can't change the these two colors is that the Calendar control generates a style="" attribute for them that can't be overriden via a CSS class attribute.

There are a couple of ways around this; 1 create a derived Calendar class of your own to strip out these style attributes (in a overriden Render method); or 2. manually change the two that are getting in the way, view the HTML source and you'll see them, via the style properties of the Calendar control.

"MattC" <> wrote in message news:...
I am having trouble setting the color of the numbers in a calender control,
here's what i am using, also the background in title is silver as is the
selected day not matter what color I set the background-color to, I think
this si due to the fact taht the css is applyed to the Table and the
subsequest TD gets set to silver.

My CSS is simply at best how can i set the background-color and links color
of nested elements, I have tried things like:

table.calendartitle td{}, or .calendardays a, but I'm not sure of the
syntax.

.calendar
{
border-right:solid 1px #6699CC;
border-bottom:solid 1px #6699CC;
border-top:solid 1px #1b5086;
border-left:solid 1px #1b5086;
}

.calendartitle
{
font-size:14px;
color:WhiteSmoke;

FILTERrogidXImageTransform.Microsoft.Gradient( endColorstr='#1b5086',star
tColorstr='#4e82b9', gradientType='0');
BORDER-BOTTOM: #1b5086 1px solid;
BORDER-TOP: #6699CC 1px solid;
background-color: #4e82b9;
}

.calendarheader
{
font-weight:bold;
background-color: #1b5086;
color:WhiteSmoke;
border: solid 1px Whitesmoke;
}

.calendardays
{
background-color: #4e82b9;
color:WhiteSmoke;
border: solid 1px #1b5086;
}

.calendarselected
{
background-color: WhiteSmoke;
color: #4e82b9;
border: solid 1px #1b5086;
}

<asp:Calendar id="_dateselector" runat="server" CssClass="calendar"
DayNameFormat="Full">
<DayStyle CssClass="calendardays"></DayStyle>
<DayHeaderStyle CssClass="calendarheader"></DayHeaderStyle>
<SelectedDayStyle CssClass="calendarselected"></SelectedDayStyle>
<TitleStyle CssClass="calendartitle"></TitleStyle>
</asp:Calendar>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Applying Css on input button Von Shean HTML 4 06-22-2010 07:08 AM
Applying CSS style to dynamically generated XML galpi@mail.com Java 1 08-13-2006 08:07 PM
Applying CSS Styles to Dropdownlist =?Utf-8?B?TmVpbCBTdGV2ZW50b24=?= ASP .Net 4 05-15-2006 02:16 PM
Applying CSS to HTML Control Programatically Prakash ASP .Net 6 11-09-2005 05:32 AM
CSS: Span not applying text-color attribute Noozer HTML 2 09-26-2004 04:28 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57