0

I have 2 buttons, costButton and detailsButton, and one textbox (with associated RequiredFieldValidator) on my aspx page. costButton button and the textbox belong to ValidationGroup costValGroup.

detailsButton doesnt belong to any validation group. When it is clicked, it triggers the validators in costValGroup, which I want to avoid.

Here's the client-side code I found in asp's
ValidationGroup => WebResource.axd

function IsValidationGroupMatch(control, validationGroup) {
    if ((typeof(validationGroup) == "undefined") || (validationGroup == null)) {
        return true;
    }
    ...
}

Looks like if a validation group is not specified, it will validate all the validators.
How can I limit a validation group to itself?

Null Head
  • 2,877
  • 13
  • 61
  • 83
  • Assign `detailsButton` to its own (nonempty) validation group, or set its `CausesValidation` property to `false`. – Michael Liu Sep 08 '16 at 19:43
  • setup multiple groups; and on button clicks make sure you validate only the group that belongs with `this.Validate("costValGroup");` in `button_click` event and checking `if(this.IsValid)` immediately after that line; if at all you need to validate all groups in any button click, you can use `this.Validate();` – techspider Sep 08 '16 at 19:58

0 Answers0