Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Picker Value

Status
Not open for further replies.

MJV57

Programmer
Apr 18, 2009
87
CA
I have a date picker on a form that is attached to a table. When there is a null value in the table the datepicker comes up with todays date. Is there a way to set it so it comes up blank when the datevalue in the table is null.
 
i do not think so since the datevaluepicker.value needs to be a datetime datatype. as far as I know there is no such thing as a null data value. it needs to be a valid date. What you can do though is detect that the value from the db is null and then sent it to datetime.minvalue or datetime.maxvalue. What is your goal is setting the datetime to a null-like value? Do you want force the user to select a valid date? If so, then setting the date to min or max will work. Just before you submit the form, see if the value is min/max and thrown a message to the user telling them they need to manually select a valid date.

Here is a tip though, I have had issues with DateTimePicker value being sent to min/max. So what you can do is set the value to a year after min or a year before max.

Hope that helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top