?
Solved

Getting Validation Summary info

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

Thanks
0
Comment
Question by:gromul
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 28

Accepted Solution

by:
mmarinov earned 2000 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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

741 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