Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / September 2007

Tip: Looking for answers? Try searching our database.

DateTimePicker and visibility to Min/Max Dates.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chris Shepherd - 21 Sep 2007 16:53 GMT
Greetings group,

I have a situation where I'd like to visibly see disabled dates on a
DateTimePicker. Frequently the Min and Max dates in the picker will be
set only to days apart, and so I would like this to be reflected in a
way other than it simply failing to select when they click. It seems
like this would be doable with a MonthCalendar control, however the
DateTimePicker itself doesn't seem to expose an internal MonthCalendar,
nor does it provide any kind of hihglighting options.

I'm open to any/all crazy suggestions. :)

Chris.
Ignacio Machin ( .NET/ C# MVP ) - 21 Sep 2007 17:19 GMT
Hi,

> Greetings group,
>
[quoted text clipped - 7 lines]
>
> I'm open to any/all crazy suggestions. :)

IIRC  you can control how each cell will looks like in the control. You
could set the CssClass to a style that the text is not visible. So it will
be "invisible"
OZI - 21 Sep 2007 19:29 GMT
This must be for a WinForm,  I don't see CssClass.

> Hi,
>
[quoted text clipped - 13 lines]
> could set the CssClass to a style that the text is not visible. So it will
> be "invisible"
Ignacio Machin ( .NET/ C# MVP ) - 21 Sep 2007 19:37 GMT
Hi,

> This must be for a WinForm,  I don't see CssClass.

My bad, I though it was for a web app.

But still the idea is valid, just to try to have the same color of the
font/background in the needed cells.
Chris Shepherd - 21 Sep 2007 19:41 GMT
> My bad, I though it was for a web app.
>
> But still the idea is valid, just to try to have the same color of the
> font/background in the needed cells.

The trouble is visibility to those cells.

Chris.
OZI - 21 Sep 2007 19:42 GMT
Yes the Idea is valid in theory and thin air.  I don't see how to control
each individual day format.
It is not available like on in the web control.

> Hi,
>
[quoted text clipped - 4 lines]
> But still the idea is valid, just to try to have the same color of the
> font/background in the needed cells.
Ignacio Machin ( .NET/ C# MVP ) - 21 Sep 2007 21:28 GMT
Hi,

> Yes the Idea is valid in theory and thin air.  I don't see how to control
> each individual day format.
> It is not available like on in the web control.

You are right, it's not available.

You will have to do it yourself. Before doing that I advise you to google
aroudn for projects, this may be asked and answered before.
For example a query of datetimepicker color in google returned this:
http://www.codeproject.com/cs/miscctrl/extended_datetimepicker.asp

Otherwise take a look at some commercial options like Infragistics.
Infragistics implement a kind of CSS for windows controls that is super
cool, You can change the look of your application on the fly and the
controls are very configurable
Chris Shepherd - 21 Sep 2007 23:40 GMT
> You will have to do it yourself. Before doing that I advise you to google
> aroudn for projects, this may be asked and answered before.
> For example a query of datetimepicker color in google returned this:
> http://www.codeproject.com/cs/miscctrl/extended_datetimepicker.asp

Yeah, I had googled and found several similar but not quite examples of
other controls. I was just wondering if there was some kind of simpler
method that I had somehow missed.

> Otherwise take a look at some commercial options like Infragistics.
> Infragistics implement a kind of CSS for windows controls that is super
> cool, You can change the look of your application on the fly and the
> controls are very configurable

Looks cool, I may have to see if management will go for it.

Chris.
Chris Shepherd - 21 Sep 2007 19:41 GMT
> IIRC  you can control how each cell will looks like in the control. You
> could set the CssClass to a style that the text is not visible. So it will
> be "invisible"

This isn't a web control, but a WinForms control.

Chris.
OZI - 21 Sep 2007 19:30 GMT
Are you saying MinDate and MaxDate properties will not do it for you?

> Greetings group,
>
[quoted text clipped - 9 lines]
>
> Chris.
Chris Shepherd - 21 Sep 2007 19:40 GMT
> Are you saying MinDate and MaxDate properties will not do it for you?

Nope, try it yourself. Just add a DateTimePicker and a MinDate and
MaxDate, and for me, by default, it simply means the user can't click
those dates once the MonthCalendar control has dropped down. Visibly
there isn't a difference between a valid date in the current month and
an invalid date in the current month.

Chris.
OZI - 21 Sep 2007 19:44 GMT
Okay so what  you want to do with the invalid dates is to make them
invisible.
There must be a way to override the rendering, but I don't see how now.

>> Are you saying MinDate and MaxDate properties will not do it for you?
>
[quoted text clipped - 5 lines]
>
> Chris.
OZI - 21 Sep 2007 19:48 GMT
this might help or give you some direction

http://www.codeproject.com/cs/miscctrl/extended_datetimepicker.asp

>> Are you saying MinDate and MaxDate properties will not do it for you?
>
[quoted text clipped - 5 lines]
>
> Chris.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.