Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking 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 Basics 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
  #1 (permalink)  
Old December 20th, 2007, 01:42 AM
Authorized User
 
Join Date: Dec 2007
Location: valsad, gujarat, India.
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to dharmeshtandel
Default Date comparision in asp.net

Dear All,
I have a problem regarding the dates.
i want to compare a two dates in asp.net2.0.
i want to check whether the second date is greater then firstdate.
so which validator control i will used in this situation and how?.
please give me the positive reply if any..

Thanks,
Regards
Dharmesh Tandel

dharmeshtandel
__________________
dharmeshtandel
  #2 (permalink)  
Old December 20th, 2007, 04:32 AM
Friend of Wrox
 
Join Date: Aug 2006
Location: Bangalore, Karnataka, India.
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
Default

well i feel compare validator may not solve yours problem its better to check it in code as if(firstdate > seconddate)


thanks......
  #3 (permalink)  
Old December 20th, 2007, 09:45 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Use DateTime.Compare()
http://msdn2.microsoft.com/en-us/lib...e.compare.aspx

================================================== =========
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
================================================== =========
  #4 (permalink)  
Old December 20th, 2007, 03:17 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

From MSDN CompareValidator Members:

"Type: Gets or sets the data type that the values being compared are converted to before the comparison is made. (Inherited from BaseCompareValidator.)"

Set it to DateTime and it will use the standard DateTime comparer.

-Peter
  #5 (permalink)  
Old December 22nd, 2007, 02:20 PM
Registered User
 
Join Date: Dec 2007
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Dharmaesh

Date Comparison can be done with Compare Validator
Just Add Compare Validator .In Properties Select Type=Date
Operator=Greater (as u require from drop down) and Fill Up
Control To Compare and Control To Validate

Hope this works

Cheers



Swathi


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date problem in asp.net 1.1 kalpesh.mahajan ASP.NET 1.0 and 1.1 Basics 0 August 14th, 2006 07:45 AM
C#(ASP.NET) Validate date entry richie86 ASP.NET 1.0 and 1.1 Basics 1 November 3rd, 2005 01:58 AM
How to post the date to another page ASP.NET? rpkarthic ASP.NET 1.x and 2.0 Application Design 1 August 12th, 2005 04:06 AM
Setting date format from ASP.NET jonashilmersson Crystal Reports 0 November 14th, 2003 04:14 AM





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