Try our conversational search powered by Generative AI!

Class StaticValidator

Validator that can be used to indicate validation errors that have been handled programmatically.

Inheritance
System.Object
StaticValidator
Implements
System.Web.UI.IValidator
Namespace: EPiServer.Web.WebControls
Assembly: EPiServer.Cms.AspNet.dll
Version: 11.20.7
Syntax
public class StaticValidator : BaseValidator, IValidator

Constructors

StaticValidator()

Initializes a new instance of the StaticValidator class.

Declaration
public StaticValidator()

StaticValidator(String)

Initializes a new instance of the StaticValidator class.

Declaration
public StaticValidator(string errorMessage)
Parameters
Type Name Description
System.String errorMessage

The error message.

Remarks

The error message will by default be HTML encoded

StaticValidator(String, Boolean)

Initializes a new instance of the StaticValidator class.

Declaration
public StaticValidator(string errorMessage, bool htmlEncodeErrorMessage)
Parameters
Type Name Description
System.String errorMessage

The error message.

System.Boolean htmlEncodeErrorMessage

If the error message should be encoded

Methods

ControlPropertiesValid()

Determines whether the control specified by the System.Web.UI.WebControls.BaseValidator.ControlToValidate property is a valid control. Since this control is programatically added when an errormessage should be displayed it always returns true.

Declaration
protected override bool ControlPropertiesValid()
Returns
Type Description
System.Boolean

EvaluateIsValid()

When overridden in a derived class, this method contains the code to determine whether the value in the input control is valid.

Declaration
protected override bool EvaluateIsValid()
Returns
Type Description
System.Boolean

true if the value in the input control is valid; otherwise, false.

Remarks

Since this control is programatically added when an errormessage should be displayed it always returns false.

Render(HtmlTextWriter)

Writes the error message inside an <span class=&quot;errormessage&quot;> tag

Declaration
protected override void Render(HtmlTextWriter output)
Parameters
Type Name Description
System.Web.UI.HtmlTextWriter output

The output.

Implements

System.Web.UI.IValidator

Extension Methods