Validation in ASPX

  • Thread starter Thread starter Paul King
  • Start date Start date
P

Paul King

Hi there,

I have a RequiredFieldValidator for one of my ASP textboxes. In addition, I
have another TextBox where the user can enter date information. I would
therefore like to validate the input so that only the format dd/mm/yy is
correct.

At present, if someone types a character in this field, a SQL error message
occurs - which isn't that helpful to the user.

Any ideas?

Thanks
Paul
 
Paul King said:
Hi there,

I have a RequiredFieldValidator for one of my ASP textboxes. In addition, I
have another TextBox where the user can enter date information. I would
therefore like to validate the input so that only the format dd/mm/yy is
correct.

At present, if someone types a character in this field, a SQL error message
occurs - which isn't that helpful to the user.

Any ideas?

Thanks
Paul

1) CompareValidator with Operator set to DataTypeCheck and Type set to Date
BUT: I'm not sure exactly what syntax is used.

2) CustomValidator with server side code trying to parse the date

Hans Kesting
 
Thanks Hans,

In this case I resolved it using the RegularExpressionValidator
and inserted the correct syntax under the ValidationExpression

Many thanks for your help
Paul.
 
Another option is RegularExpressionValidator.

Hi there,

I have a RequiredFieldValidator for one of my ASP textboxes. In addition, I
have another TextBox where the user can enter date information. I would
therefore like to validate the input so that only the format dd/mm/yy is
correct.

At present, if someone types a character in this field, a SQL error message
occurs - which isn't that helpful to the user.

Any ideas?

Thanks
Paul
 
Paul King said:
Thanks Hans,

In this case I resolved it using the RegularExpressionValidator
and inserted the correct syntax under the ValidationExpression

Many thanks for your help
Paul.

True, I forgot that one. Has client-side response (=quick) and good control
over syntax. However it can't handle leap-years correctly!

Hans Kesting
 
Shiva,

Please see my last email re: RegularExpressionValidator.

:)

Thanks
Paul.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top