validate a date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there any way of using a validation control in c#.Net which finds out if
the date provided in a textbox is equal to or greater than the current date.
Does anyone know how to do this. Or does anyone know how to do this using c#
code.

Thanks for any help anyone is able to give me.
 
you will have to create a custom validator and add appropriate code comparing the value of the textbox to Now()

hope this helps

phil
Is there any way of using a validation control in c#.Net which finds out if
the date provided in a textbox is equal to or greater than the current date.
Does anyone know how to do this. Or does anyone know how to do this using c#
code.

Thanks for any help anyone is able to give me.
 
Tried the following but it didn't work. would you be able to help me change
this so as it did what I wanted

function DateCompatre(sender, args))
{
if(now() >= document.WebForm2.txtDate.Text)
{
args.IsValid = true;
return;
}
args.IsValid = false;
}
 
Stephen said:
Tried the following but it didn't work. would you be able to help me change
this so as it did what I wanted

if(now() >= document.WebForm2.txtDate.Text)

If now() uses DateTime.now, then what you get back is DateTime. How
do you compare apples with oranges? (struct with string object)

Otherwise, there is not enough enformation to help you.
 
Back
Top