ModelStateDictionary.AddModelError Method
Namespace: System.Web.Http.ModelBinding
Assembly: System.Web.Http (in System.Web.Http.dll)
Overload List
Name | Description | |
---|---|---|
AddModelError(String, Exception) | Adds the specified model error to the errors collection for the model-state dictionary that is associated with the specified key. |
|
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
key
Type: System.StringThe key.
exception
Type: System.ExceptionThe exception.
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
key
Type: System.StringThe key.
errorMessage
Type: System.StringThe error message.
Return to top