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 _
)
'Usage
Dim instance As ModelStateDictionary 
Dim key As String 
Dim exception As Exception

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

Parameters

See Also

Reference

ModelStateDictionary Class

AddModelError Overload

System.Web.Mvc Namespace