Click here to Skip to main content
15,884,425 members

Validate date and compare dates

pawar.vikaskwd asked:

Open original thread
hi,

I am using asp.net 4.0. I have created a web user control for date validation. The date format which i am using is "dd-MMM-yyyy". This control has two textboxes and next to each textbox there is calender extender(Ajax control) and also i am using watermark extender for textboxes. So i want create control such that user either can not enter anything in textbox (Enabled="False") or if user enters date it should validate the date and if the dates are valid i have to compare dates.

When i am disabling textboxes to prevent user to enter text, i am getting textbox value as "null" in control. When i am allowing users to enter text i have to validate date. This problem i have solved some extent by using regular expression. But the main problem i am facing is comparing the two dates. I have used compare validator and i have used tried Jquery for this. When i am using compare validator, its comparing only days in date not whole date. And when i am using jquery, it is behaving different for diiferent browsers.

So please can anyone help me to solve this problem either with compare validator or Jquery.

Thanks in advance.
Tags: jQuery, DateTime, Validation

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900