Disable Validation on all items inside a panel
is it possible to disable validation of all items inside a panel programatically in vb.net?
i can't seem to figure it out.
i disabled all fields inside a panel, but they still cause the page to validate on submit.
this is what i have now:
Public开发者_如何学Go Sub DisableControls(ByVal parent As Control) Dim cCon As Control For Each cCon In parent.Controls If (TypeOf cCon Is TextBox) Then CType(cCon, TextBox).Enabled = False CType(cCon, TextBox).CausesValidation = False End If If (TypeOf cCon Is DropDownList) Then CType(cCon, DropDownList).Enabled = False CType(cCon, DropDownList).CausesValidation = False End If Next End Sub
it disables the controls just fine,but validations till works :(
CausesValidation
just disables the behavior of your controls so that when one of them causes a post-back, validation is skipped.
You have to disable validators.
精彩评论