Wrox Programmer Forums
|
Visual Studio 2005 For discussing Visual Studio 2005. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Studio 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 29th, 2007, 12:10 AM
Registered User
 
Join Date: Apr 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default nullable datetimepicker.value

Hi,
i want the user to be able to select null value from datetimepicker. i found that by using showcheckbox = true, i can control whether user needs to input value or not.

the problem is that i am using a validation, whereby
if the checkbox is not checked than it datetimepicker.value = ""
but it is giving me an error

please help with this

thanks

 
Old May 4th, 2007, 03:31 PM
Registered User
 
Join Date: Jan 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You are setting it to blank "" which is not a date. You need to set it to null.
It would be useful if you posted the exact error message you are getting.
 
Old January 4th, 2010, 04:29 PM
Registered User
 
Join Date: Jan 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Wink nullable datetimepicker

Quote:
Originally Posted by Anar View Post
Hi,
i want the user to be able to select null value from datetimepicker. i found that by using showcheckbox = true, i can control whether user needs to input value or not.

the problem is that i am using a validation, whereby
if the checkbox is not checked than it datetimepicker.value = ""
but it is giving me an error

please help with this

thanks
1. Bind your datetimepicker.text, not datetimepicker.value
2. Add this code in datetimepicker_Validating(object sender, CancelEventArgs e) event:

if (!datetimepicker.Checked)
((Order)orderBindingSource.Current).OrderDate= null;

I hope it works in your case





Similar Threads
Thread Thread Starter Forum Replies Last Post
Nullable Type Question Aaron Edwards ASP.NET 2.0 Professional 1 August 30th, 2007 07:37 AM
Nullable Datetime shivamnshah BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 3 April 26th, 2007 12:46 PM
Nullable DateTime formatting sajan C# 2005 1 March 19th, 2007 12:43 PM
Question about Nullable Types Aaron Edwards ASP.NET 2.0 Basics 5 December 10th, 2006 11:57 PM
Keycode is non-nullable salaikumar VS.NET 2002/2003 0 May 22nd, 2006 12:47 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.