共用方式為


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)
Available in Sandboxed Solutions: No

Syntax

'Declaration
Protected Overridable Sub RenderValidationMessage ( _
    output As HtmlTextWriter _
)
'Usage
Dim output As HtmlTextWriter

Me.RenderValidationMessage(output)
protected virtual void RenderValidationMessage(
    HtmlTextWriter output
)

Parameters

Remarks

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().

See Also

Reference

BaseFieldControl Class

BaseFieldControl Members

Microsoft.SharePoint.WebControls Namespace

IsValid

Validate

ErrorMessage

Other Resources

How to: Create a Custom Field Type

Custom Field Types

Walkthrough: Creating a Custom Field Type