Click here to Skip to main content
16,004,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have one datetime picker name StartDatetimepicker . when i select No date from datetimepicker it save Today date in my database but i want when no date is selected then null value save in database . Any One Help me Thnks

What I have tried:

i have no code about this paroblem.
Posted
Updated 15-Jun-18 4:06am
Comments
Eric Lynch 15-Jun-18 9:53am    
This question needs more information, starting with: database table name, column name, column type (is it nullable?), database technology (ADO.NET, LINQ to SQL, LINQ to Entities), etc. Depending on the approach you choose, you should at least try first. Then, you can ask a more specific question. There is simply not enough information in your question for anyone to provide you with meaningful assistance.

1 solution

As far as I am aware, there is no DateTimePicker control which directly allows a "no date" option - if the user does not select a date it will always display and return todays date by default.

To add this function, you'd need to add a checkbox labeled "No date" which hides the DTP when checked, and unhides it when unchecked.
Your code then checks that first and decides what to save in your DB.
 
Share this answer
 

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