-
November 19th, 2012, 04:25 PM
#1
setting default DateTime control
Hello!
I have two dateTime controls, one for a start date of search and one for end date. I'm using the dates to search
file creation dates and then storing them into a array. I would like to have the search include all files if a dateTime
is not picked. Any suggestion about how to do this? Can you do it in the get; set ; ?
Code:
public DateTime startDate
{
get { return startDate; }
set { startDate = value; }
}
public DateTime endDate
{
get { return endDate; }
set { endDate = value; }
}
Thanks for your time in this for me
Stevish
-
November 23rd, 2012, 04:18 AM
#2
Re: setting default DateTime control
Ahh,, the age old ugliness of a nullable date time picker rears its head again..
http://stackoverflow.com/questions/5...lue-to-be-null
But i've most often found it to be a better UI design decision to put a separate checkbox next to the picker, and enable/disable the picker (or change its customformat from space, to yyyymmdd and back again) when the checkbox is checked/unchecked, so that people more obviously know what theyre searching for
When it comes time to do the query, if checkbox is not checked, pass DateTime.Min/MaxValue depending on whether it's the date from, or date to, that is checked:
Avoid the temptation to set the picker value to DateTime.MinValue because it loses the users previous choice, and puts them back a huge number of years which makes the ui a nuisance for them to use
The checkbox inside the picker is too small to be helpful/usable I think
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|