seeing if a control isValid

D

darrel

I'm stuck on some syntax. I'm building my own summary validator. I'm walking
through the controls to see which ones are validator controls. Then, for
each one that is, I want to check the isValid state:

if instr(child.GetType.ToString(), "validator") then
*check validity
End If

The problem is that I'm stuck on how to check the particular webcontrol to
see if it isValid

I can obviously grab the object and check:

RequiredFieldValidator_email.isvalid
but since I'm walking through each webControl, I need a way to check the
current control. Something like this:
if theCurrentControl.isValid then

But I'm totally stuck on the syntax for this.

-Darrel
 
S

Shiva

This might help you:

If (TypeOf child Is BaseValidator) Then
child.Validate()
If (Not child.IsValid) Then
' Get the error message...
End If
End If

I'm stuck on some syntax. I'm building my own summary validator. I'm walking
through the controls to see which ones are validator controls. Then, for
each one that is, I want to check the isValid state:

if instr(child.GetType.ToString(), "validator") then
*check validity
End If

The problem is that I'm stuck on how to check the particular webcontrol to
see if it isValid

I can obviously grab the object and check:

RequiredFieldValidator_email.isvalid
but since I'm walking through each webControl, I need a way to check the
current control. Something like this:
if theCurrentControl.isValid then

But I'm totally stuck on the syntax for this.

-Darrel
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top