RegularExpressionValidator???

F

franz

does anybody tell me why it doesn't works?? in any case gg beame true

thanks
franz

Dim y As RegularExpressionValidator = New RegularExpressionValidator
y.ValidationExpression =
"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$"
y.ControlToValidate = "ss5ssss"
Dim gg As Boolean = y.IsValid
 
K

Karl Seguin

Franz:
If that's ur code, it doesn't work like that. You don't simply assign the
controlToValidate and the isValid will be set accordingly. During the
RaisePostBackEvent, the page calls Validate() on the control which forces
the validation.

You might try modifyning your code to do:

Dim y As RegularExpressionValidator = New RegularExpressionValidator
y.ValidationExpression =
"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$"
y.ControlToValidate = "ss5ssss"
y.Validate()
Dim gg As Boolean = y.IsValid

But I'm not sure if it'll work because it'll never render. To be honest, if
you aren't rendering a control, why not just use a System.Text.Regex ??

Karl
 

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

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,811
Latest member
SaulFernan

Latest Threads

Top