Link to home
Start Free TrialLog in
Avatar of dev_ven
dev_ven

asked on

How can you clear all Validation Errors?

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

ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of dev_ven
dev_ven

ASKER

I just have it where the tooltip appears to the side of the textbox.