Which override method should you use?

You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You derive a new validation control from the BaseValidator class.
The validation logic for the control is implemented in the Validate method in the following manner.

Protected Shared Function Validate(value As String) As Boolean
End Function

You need to override the method that validates the value of the related control.
Which override method should you use?

You create a Microsoft ASP.NET application by using the Microsoft .NET Framework version 3.5.
You derive a new validation control from the BaseValidator class.
The validation logic for the control is implemented in the Validate method in the following manner.

Protected Shared Function Validate(value As String) As Boolean
End Function

You need to override the method that validates the value of the related control.
Which override method should you use?

A.
Protected Overrides Function EvaluateIsValid() As Boolean
Dim value As String = GetControlValidationValue(Me.Attributes("AssociatedControl"))
Dim isValid As Boolean = Validate(value)
Return isValid
End Function

B.
Protected Overrides Function ControlPropertiesValid() As Boolean
Dim value As String = GetControlValidationValue(Me.ValidationGroup)
Dim isValid As Boolean = Validate(value)
Return isValid
End Function

C.
Protected Overrides Function EvaluateIsValid() As Boolean
Dim value As String = GetControlValidationValue(Me.ControlToValidate)
Dim isValid As Boolean = Validate(value)
Return isValid
End Function

D.
Protected Overrides Function ControlPropertiesValid() As Boolean
Dim value As String = GetControlValidationValue(Me.Attributes("ControlToValidate"))
Dim isValid As Boolean = Validate(value)
Me.PropertiesValid = isValid
Return True
End Function



Leave a Reply 0

Your email address will not be published. Required fields are marked *