Would like to disable validation for entire page

  • Thread starter Thread starter Mike Hnatt
  • Start date Start date
M

Mike Hnatt

I'd like to conditionally enable or disable the page validation. I was
thinking something like;

Enummerate through all controls...if control is validation control type,
then control.ControlToValidate = ""

I think that would work but I don't know how to ennumerate through each
control and check to see if it is a validatior control or not. Also, would
this method even work?

Thanks,
Mike
 
I found a solution, Here is what I did....

Dim ctl As Control
Dim pnl As Control
pnl = Page.FindControl("myPanel")
For Each ctl In pnl.Controls
If ctl.GetType.BaseType.Name.ToString =
"BaseValidator" Then
ctl.Visible = False
End If
Next
 
Back
Top