[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1501
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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