Date Time Picker

  • Thread starter Thread starter Charles A. Lackman
  • Start date Start date
C

Charles A. Lackman

Hello,

I have a DateTimePicker on my form and I need to make every Even week Red
and every Odd week Yellow.

Any Suggestions will be greatly appreciated (Detailed help is even more
appreciated).

Thanks,

Chuck
 
Hi Chuck,

Are you talking about the Calendar server control that comes with ASP.Net?
If so, I don't see any properties on it that let you do that. So in order
to make it happen you need to override the Render event for that control and
modify the output from there. The easiest way would be to set the color of
the day to some odd value. Then in the render event find where that value
is and set it's color alternating by 7s. If this is a control you created
then the easiest way would be to alternate the value of the color everytime
you start a new row. If you aren't using the Calendar control could you
post some code to see what you are doing. I'm not sure how to answer this
question. Good luck! Ken.
 
Hi Chuck,

Sorry! I forgot what forum I was in. I was thinking ASP.Net all the way
and didn't realize this was the general forum. Hopefully someone will
provide you with the correct answer soon. Ken.
 
Chuck,

First, please don't crosspost. Select the newsgroup that seems to be the bet
suited to your question. People will refer you to more appropriate
newsgroups if you missed. When you crosspost, I have no idea if your
question has already been answered elsewhere. Thanks.

From the docs [1], it looks like you want behavior that is not built in to
the DateTimePicker. I would create a new control, e.g.,
AlternatingDateTimePicker that inherits from DateTimePicker, and then
override the drawing of the control. There are plenty of examples of custom
drawn controls.

Cheers,
Stuart Celarier, Fern Creek

[1]
http://msdn.microsoft.com/library/e...ystemwindowsformsdatetimepickerclasstopic.asp
 
Slightly off topic but then again, maybe not...

Keep in mind that week numbers are not calculated the same way everywhere,
just like the first day of the week is not always Sunday. It can also be
Monday. The 2nd of January 2005 is in week 1 in some parts of the World and
in week 53 in other.
 
Back
Top