Solved

Getting Validation Summary info

Posted on 2004-03-29
3
258 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 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

697 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