Wrox Programmer Forums
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional 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 December 13th, 2007, 11:41 AM
Authorized User
 
Join Date: Nov 2007
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to validate date

I have a textbox such that when the user enters the value in the textbox it should check whether the value entered is valid date or not.How to use the validation controls.

 
Old December 13th, 2007, 11:47 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Quote:
quote:Originally posted by jijish
 I have a textbox such that when the user enters the value in the textbox it should check whether the value entered is valid date or not.How to use the validation controls.

For you application, what is a "valid" date? For example in my applications a valid date is MM/DD/YYYY but some countries use the DD/MM/YYYY format so on and so on and so on.

Couple of things you can do, you can use the DateTime method TryParse() which returns a bool if the specified string can be parsed into a Valid date time. The only thing this will tell you, of course, is if the string is a valid date time.

You can also write a regular expression to check for a speicfic Date format such as MM/DD/YYYY.

hth.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor :.
Wrox Books 24 x 7
================================================== =========
 
Old December 19th, 2007, 10:04 AM
Friend of Wrox
 
Join Date: Aug 2006
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
Default

please4 have a look on this thread

http://p2p.wrox.com/topic.asp?TOPIC_ID=67723


thanks......
 
Old December 20th, 2007, 07:15 AM
Authorized User
 
Join Date: Nov 2007
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your help.

 
Old December 20th, 2007, 07:17 AM
Friend of Wrox
 
Join Date: Aug 2006
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
Default

welcome Man

thanks......





Similar Threads
Thread Thread Starter Forum Replies Last Post
Validate date format is correct gayatrikeshkamat VB How-To 0 April 4th, 2006 07:48 AM
Validate Date sparc ASP.NET 1.0 and 1.1 Basics 1 September 20th, 2005 09:55 AM
Validate Expiration date mariakovacs Classic ASP Basics 4 January 26th, 2004 12:53 PM
validate date javascript lcsgeek Classic ASP Basics 3 October 3rd, 2003 04:07 PM
how to validate a date clientside lcsgeek Classic ASP Professional 2 October 3rd, 2003 03:25 AM





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