Validation

  • Thread starter Thread starter Mark A. Sam
  • Start date Start date
M

Mark A. Sam

Hello,

I placed a RegularExpressionvalidator on a webform to test a textbox for a
proper email format. I am trying to test for a failure but can't seem to
get a value. Here is what I tried:

EmailValidator.Validate()
If Not Page.IsValid Then
Beep()
txtEmail.Focus()
End If

ALSO

EmailValidator.Validate()
If Page.IsValid = False Then
Beep()
txtEmail.Focus()
End If

THEN

EmailValidator.Validate()
If Page.IsValid Then
'nothing
Else
Beep()
txtEmail.Focus()
End If
None of these three methods works, but

If Page.IsValid Then

Is recognized.



Thanks for any help

God Bless,



Mark A. Sam
 
Mark,
just like you said by design the validators prevent your code from running
when not valid.

Good Luck
DWS
 

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

Similar Threads

Page.Invalid 5
Validation 7
Validation problem 6
Validate page programmatically 1
validation doesn't fire 6
Regular Expression Validator 6
How to use ASP.NET validators 4
No Validation 2

Back
Top