BaseFieldControl.RenderValidationMessage method

Renders an error message about the invalidity of the value in the Value property.

Namespace:  Microsoft.SharePoint.WebControls
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

protected virtual void RenderValidationMessage(
	HtmlTextWriter output


Type: System.Web.UI.HtmlTextWriter

The object that writes the HTML that is to be rendered.

With the default implementation, RenderValidationMessage does nothing if IsValid is true.

If IsValid is false, an error message is rendered. This is the value of ErrorMessage, unless it is a null reference (Nothing in Visual Basic) in which case a generic error message is rendered.

Notes to inheritors

Value is the value of the control in the UI, not the underlying value (which is ItemFieldValue) of the SPField object that has the BaseFieldControl as its FieldRenderingControl property. Use RenderValidationMessage only when you need validation of the UI value. To validate ItemFieldValue, use GetValidatedString().