I am having problems trying to invoke just one validator on it own, I know how to call on all validators to perform checks on buttons click events, by using Page.Validate()
but how can I invoke lets say mySingledOutValidator
I tried mySingledOutValidator.Validate()
but that's not gonna work individual controls don't have .validate()
I need the following to be true:
- Get a single validation to happen
- In C# Asp.Net
- .net 2.0 framework
If the above is not possible I do n开发者_StackOverflowot mind looking into javascript alternatives.
If you can help it would be greatly appreciated.You can use Group Validation. You can assign a validator a validationgroup
value, and then explicitly validate that group, which can contain 1 or more validators.
Page.Validate("MyGroup");
You can also check the validation status of each validator explicitly using IsValid
property, assuming validation has already taken place.
According this article:
function ValidatorValidate(val, validationGroup, event)
With jquery validators:
And in case I wanted to force the validation I should have written:
ValidatorValidate($("#<%= valEncOtherMimeTypeRequired.ClientID %>")[0]);
精彩评论