Solved

Getting Validation Summary info

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Question has a verified solution.

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

Suggested Solutions

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
It seems a simple enough task, yet I see repeated questions asking how to do it: how to pass data between two forms. In this article, I will show you the different mechanisms available for you to do just that. This article is directed towards the .N…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

856 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