• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1621
  • Last Modified:

ASP.NET ValidationSummary ShowMessageBox="True" ShowSummary="False"

I'm using a ValidationSummary on my asp.net 4.0 page. I have ShowMessageBox="True" ShowSummary="False". This is supposed to pop a javascript alert with all the validation error messages, and also NOT show the error messages (summary) directly on the web page, in the div or however they do it. It does show the alert as expected but also shows the messages inline in the page--it shouldn't.

I have another asp.net page that is set up the same way, but it works correctly. Also has ShowMessageBox="True" ShowSummary="False", but it shows the alert and hides the inline text--which is correct.

I can't figure out why it works on one page on not on the other, with same options in place.
0
SweatCoder
Asked:
SweatCoder
  • 6
  • 5
1 Solution
 
silemoneCommented:
can you post both validation tags completely so I can compare them...i have used validations many times, so i should be able to help.
0
 
silemoneCommented:
Well see this link...and make sure the settings are correct with both the validator and the validationsummary.

http://msdn.microsoft.com/en-us/library/1ze30x3t(v=vs.71).aspx
0
 
silemoneCommented:
Make sure you're using ErrorMessage property instead of the Text property to store you error message in the validator control also.
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
SweatCoderAuthor Commented:
This one doesn't work right:

<asp:validationsummary id="summInvoiceValidator" ValidationGroup="group1"
                            runat="server" HeaderText="MyApp" ShowMessageBox="True" ShowSummary="False" DisplayMode="List">  
</asp:validationsummary>

This one does work right:

<asp:validationsummary id="ValSumAF" ValidationGroup="group2"
            runat="server" HeaderText="MyApp" ShowMessageBox="True" ShowSummary="False" DisplayMode="List">  
</asp:validationsummary>  

These 2 are on different aspx pages.

silemone: I'm interested to know your ideas.
0
 
SweatCoderAuthor Commented:
silemone: As far as I can see, I'm doing everything correctly. Still no joy.
0
 
silemoneCommented:
Ok...and does the <Required validation  (whichever  you're using) use the same ValidationGroup?

Does it have ErrorMessage set (NOT Text property, but ErrorMessage propert)?  Is the Display set to None?
0
 
silemoneCommented:
remember there will be 3 components:

1) <asp:Textbox...>
2) <asp:RequiredValidation...>
3) <asp:ValidationSummary...>

2) must have ValidationGroup the same as 3)
2) must have ErrorMessage Property Set
2) must have Display set to 'None'
2) must have the ControlToValidate set to 1) ID

1) 2) 3) -> must have distinct IDs and runat='server'


0
 
silemoneCommented:
If your problem continues, i must advise you to create a small mini-version of this program with one field, one button, etc. and get it to work.
0
 
SweatCoderAuthor Commented:
>>

remember there will be 3 components:

1) <asp:Textbox...>
2) <asp:RequiredValidation...>
3) <asp:ValidationSummary...>

2) must have ValidationGroup the same as 3)
2) must have ErrorMessage Property Set
2) must have Display set to 'None'
2) must have the ControlToValidate set to 1) ID

1) 2) 3) -> must have distinct IDs and runat='server'

Yes...I'm doing all those things. That's why I'm stumped.
0
 
SweatCoderAuthor Commented:
I never solved the root problem, but I found a nice workaround. I simply wrapped my validators in this:

<div style="display:none">

</div>

All I want is the client-side alerts for validation, so this works great.
0
 
SweatCoderAuthor Commented:
Silemone, I don't think your post solved my problem (it never did get solved), but my workaround is good and I want to close this out.
0
 
Dave SextonCommented:
I think the reason is that the ShowMessageBox attribute wants true or false not True or False. The one case where it works for you is because the default is true, both of your examples are technically not working.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now