Share via


ModelStateDictionary.AddModelError Method (String, String)

Adds the specified error message to the errors collection for the model-state dictionary that is associated with the specified key.

Namespace:  System.Web.Http.ModelBinding
Assembly:  System.Web.Http (in System.Web.Http.dll)

Syntax

'Declaration
Public Sub AddModelError ( _
    key As String, _
    errorMessage As String _
)
'Usage
Dim instance As ModelStateDictionary
Dim key As String
Dim errorMessage As String

instance.AddModelError(key, errorMessage)
public void AddModelError(
    string key,
    string errorMessage
)
public:
void AddModelError(
    String^ key, 
    String^ errorMessage
)
member AddModelError : 
        key:string * 
        errorMessage:string -> unit 
public function AddModelError(
    key : String, 
    errorMessage : String
)

Parameters

See Also

Reference

ModelStateDictionary Class

AddModelError Overload

System.Web.Http.ModelBinding Namespace