Solved

Getting Validation Summary info

Posted on 2004-03-29
3
252 Views
Last Modified: 2012-06-22
Is there a way to extract error messages contained in ValidationSummary control?

Thanks
0
Comment
Question by:gromul
3 Comments
 
LVL 28

Accepted Solution

by:
mmarinov earned 500 total points
ID: 10711401
I don't know what is the purpose of your question ( i don't see the need ) , but actually you can not directly get the messages from the ValidationSummary. This control get the errormessages from every validator on your page

so you can use something like this

vb
Dim vc as ValidatorControl = Page.Validators
Dim Index as Integer

For Index=0 To vc.Count-1
 Response.Write(vc(Index).ErrorMessage)
Next


c#
ValidatorCollection vc = Page.Validators;
for ( int index=0; index < vc.Count; vc++ )
  Response.Write(vc[index].ErrorMessage);

HTH
B..G
0
 

Author Comment

by:gromul
ID: 10711485
Thanks mmarinov
0
 

Expert Comment

by:tigriswoods
ID: 38074949
This answer gave me what I needed, but it actually gives the text  of all the validators, whether they are valid or not.

I am loading a form from XML data and will automatically move to another page if there is no error. However, if there is an error, I have to save the errors.  I refined the accepted answer so that I see only the validators where Isvalid = false.

 Validate("UserInfo")
        If Not IsValid Then
            Dim RxErrors As String = ""
            Dim vc As ValidatorCollection = Page.Validators
            Dim Index As Integer

            For Index = 0 To vc.Count - 1
               If vc.Item(Index).IsValid = False Then
                    RxErrors += "<Error>" & (vc(Index).ErrorMessage) & "</Error>"
                End If

            Next
            If RxErrors.Trim.Length > 0 Then
                RxErrors = "<Errors>" & RxErrors & "</Errors>"
            End If


        End If
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
WPF issue with Trigger 2 69
Using MS Code on my Mac 6 47
AutoHotkey ActiveX Component Error 8 56
Get String split 5 33
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now