0

I have a validation summary on page.

<asp:ValidationSummary ValidationGroup="myValSumGroup" ID="myValSum" runat="server" />

And I have a few required validators which add to this summary:

A missing
B missing
N missing

But I have some (make it 10) additional required validators and all have the same error message

**SPECIAL is missing**

This add 10 more errors in summary. But as they have the same text is it possible to add to validation summary only:

**YOU HAVE ERRORS IN YOUR SPECIALS**

instead of

**SPECIAL is missing**
**SPECIAL is missing**
**SPECIAL is missing**
...

I have tried some JS voodoo magic but doesn't work:

<asp:Button ... OnClientClick="return Button2_onclick()" ...
<script type="text/javascript">
function Button2_onclick() {
    document.getElementById("<%=myValSum.ClientID %>").innerHTML =
        document.getElementById("<%=myValSum.ClientID %>").innerHTML + 
            "<br>  YOU HAVE ERRORS IN YOUR SPECIALS";
}
</script>     
Afzaal Ahmad Zeeshan
  • 15,669
  • 12
  • 55
  • 103
1110
  • 7,829
  • 55
  • 176
  • 334

2 Answers2

0

try adding this too, in you java-script function.

document.getElementById("<%=myValSum.ClientID %>").style.display="block";
akbar ali
  • 427
  • 2
  • 6
-1

Try to keep all validators(validator control like reqiredfieldvalidator) with common ValidationGroup which you will use in Validationsummary later.

Now,assign ErrorMessage property of every validator control to blank i.e."" or set Text property to * if you want to display it as mandatory.

At the end to display common error message of all validators,set HeaderText property of ValidationSummary to "YOU HAVE ERRORS IN YOUR SPECIALS".

You can use multiple ValidationSummary to group your errormessage based on ValidationGroup property

Amol Kadam
  • 85
  • 1
  • 10
  • I don't want to add alert I am trying to add one message for multiple messages to validation summary control. – 1110 Nov 19 '13 at 16:52
  • @1110 try this one.Earlier i was trying to achieve it with javascript with alert but let it be. I hope this works for you. – Amol Kadam Nov 19 '13 at 19:34
  • Please stop flagging this answer for moderator review. That's not what moderator flags are for. – Brad Larson Dec 06 '13 at 18:34