Solved

How can you clear all Validation Errors?

Posted on 2010-11-23
3
1,253 Views
Last Modified: 2012-05-10
I have several properties that require some validation on my Silverlight application.

I also have a reset button that I would like the user to click and clear all validation errors.

What's the best approach?

The following shows a simple property that gets validated:
    <Display(Name:="Title")> _
    <Required(ErrorMessage:="The Title field is required.")> _
    Public Property Title() As String
        Get
            Return siteTitle
        End Get
        Set(ByVal Value As String)
            'If String.IsNullOrEmpty(Value) = True Then
            '    Throw (New Exception("The Title field is require."))
            'End If

            Validator.ValidateProperty(Value, New ValidationContext(Me, Nothing, Nothing) With {.MemberName = "Title"})

            siteTitle = Value
        End Set
    End Property

Open in new window

0
Comment
Question by:dev_ven
  • 2
3 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 34199627
Are you using a validation summary? Use the

ValidationSummary.Errors.Clear() method.
0
 

Author Comment

by:dev_ven
ID: 34199695
I just have it where the tooltip appears to the side of the textbox.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 34199734
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
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…

810 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