ModelStateDictionary.AddModelError Method (String, Exception)

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

Namespace:  System.Web.Mvc
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

public void AddModelError(
	string key,
	Exception exception
)

Parameters

key
Type: System.String

The key.

exception
Type: System.Exception

The exception.

Show: