ModelStateDictionary.AddModelError Method

 

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

Overload List

Name Description
System_CAPS_pubmethod AddModelError(String, Exception)

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

System_CAPS_pubmethod AddModelError(String, String)

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

See Also

ModelStateDictionary Class
System.Web.Http.ModelBinding Namespace

Return to top

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.

Syntax

public void AddModelError(
    string key,
    Exception exception
)
public:
void AddModelError(
    String^ key,
    Exception^ exception
)
member AddModelError : 
        key:string *
        exception:Exception -> unit
Public Sub AddModelError (
    key As String,
    exception As Exception
)

Parameters

Return to top

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.

Syntax

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

Parameters

Return to top