Click here to Skip to main content
15,914,500 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi.....

In some cases the date field wil not b madatory.User no need to select a date. So we need to keep datetimepicker field blank, so that we can enter null for that field in db.
Plzzz........ help me


thanku
diya
Posted

 
Share this answer
 
Hai...

We can keep datetimepicker field as blank by setting datetimepicker Format to "Custom" and CustomFormat to "blank space". This will display the datetimepicker field as null but the value doesnt change to null.That cone be handle in ur code.


dateTimePicker1.Format = DateTimePickerFormat.Custom;
dateTimePicker1.CustomFormat =""; //a string with one whitespace
 
Share this answer
 
Hi
i have added a datetimepicker1 from toolbox
datetimepicker1.Format poperty is not getting.
 
Share this answer
 
Comments
Siva Kishore G 30-Jun-10 0:50am    
Hi Then try like this, add the datetimepicker control->select the control->go to properties->ter u find Format property->u can set ur required value to it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900