Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > .NET 2.0 and Visual Studio. 2005 > Visual Studio 2005
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old April 29th, 2007, 12:10 AM
Registered User
 
Join Date: Apr 2007
Location: , , .
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

Reply With Quote
  #2 (permalink)  
Old May 4th, 2007, 03:31 PM
Registered User
 
Join Date: Jan 2007
Location: , , .
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.
Reply With Quote
  #3 (permalink)  
Old January 4th, 2010, 03: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
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 10:57 PM
Keycode is non-nullable salaikumar VS.NET 2002/2003 0 May 22nd, 2006 12:47 AM



All times are GMT -4. The time now is 07:32 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.