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)
Syntax
'Declaration
Public Sub AddModelError ( _
key As String, _
exception As Exception _
)
public void AddModelError(
string key,
Exception exception
)
public:
void AddModelError(
String^ key,
Exception^ exception
)
Parameters
- key
Type: System.String
The key.
- exception
Type: System.Exception
The exception.