2

I have a Masterpage with a ValidationSummary.

I need to use at least two different validation groups on a subpage since I have two actions (buttons). I would like the validation messages to be shown in the validation summary on the master page. This is not possible as far as I know since the ValidationSummary is only able to display validation summary messages from one validation group.

I'm wondering what would be the best way to achieve this.

I thought of creating a custom Validation Summary which could accept a list of ValidationGroups to display messages from.

Any good ideas how to do this ?

1 Answers1

1

I actually solved this by accident one day. Do not put a ValidationGroup on your button, set CausesValidation to False and then register a OnClientClick() function that looks like this:

<asp:Button runat="server" ID="btnRequest" Text="Save" OnClientClick="Validate2('ValidationGroup')" CausesValidation="False"/>

function Validate2(valgrp) {
    var isValid = false;
    isValid = Page_ClientValidate(valgrp);
    ValidatorUpdateIsValid();
    ValidationSummaryOnSubmit(null);
    return isValid;
}

You can call this multiple times Page_ClientValidate(valgrp); inside the javascript

chongo2002
  • 131
  • 1
  • 5
  • 12