ModelStateDictionary.AddModelError ModelStateDictionary.AddModelError ModelStateDictionary.AddModelError ModelStateDictionary.AddModelError Method

Definition

Adds a model error to the errors collection.

Overloads

AddModelError(String, Exception) AddModelError(String, Exception) AddModelError(String, Exception)

Adds a model error to the errors collection using the specified key and using the specified exception for the value.

AddModelError(String, String) AddModelError(String, String) AddModelError(String, String) AddModelError(String, String)

Adds the specified model error to the errors collection using the specified key and using the specified error message string for the value.

AddModelError(String, Exception) AddModelError(String, Exception) AddModelError(String, Exception)

Adds a model error to the errors collection using the specified key and using the specified exception for the value.

public:
 void AddModelError(System::String ^ key, Exception ^ exception);
public void AddModelError (string key, Exception exception);
member this.AddModelError : string * Exception -> unit

Parameters

key
String String String String

The key.

exception
Exception Exception Exception Exception

The exception object.

Exceptions

AddModelError(String, String) AddModelError(String, String) AddModelError(String, String) AddModelError(String, String)

Adds the specified model error to the errors collection using the specified key and using the specified error message string for the value.

public:
 void AddModelError(System::String ^ key, System::String ^ errorMessage);
public void AddModelError (string key, string errorMessage);
member this.AddModelError : string * string -> unit
Public Sub AddModelError (key As String, errorMessage As String)

Parameters

key
String String String String

The key.

errorMessage
String String String String

The error message.

Exceptions

Applies to