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 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.