Bewerken

Delen via


RangeAttribute.FormatErrorMessage(String) Method

Definition

Formats the error message that is displayed when range validation fails.

public:
 override System::String ^ FormatErrorMessage(System::String ^ name);
public override string FormatErrorMessage (string name);
override this.FormatErrorMessage : string -> string
Public Overrides Function FormatErrorMessage (name As String) As String

Parameters

name
String

The name of the field that caused the validation failure.

Returns

The formatted error message.

Exceptions

The current attribute is ill-formed.

Remarks

The FormatErrorMessage creates the error message by using the name of the data field that caused the validation failure. You can override this method in a custom validation attribute to customize how errors are created, or to provide a more complex message that contains parameters that you evaluate at run time. For an example, see the RangeAttribute.RangeAttribute constructor.

Applies to