Solved

How can you clear all Validation Errors?

Posted on 2010-11-23
3
1,234 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

707 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

20 Experts available now in Live!

Get 1:1 Help Now