ModelStateDictionary.AddModelError Method

 

Adds a model error to the errors collection for the model-state dictionary.

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

NameDescription
System_CAPS_pubmethodAddModelError(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_pubmethodAddModelError(String, String)

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

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.

public void AddModelError(
	string key,
	Exception exception
)

Parameters

key
Type: System.String

The key.

exception
Type: System.Exception

The 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.

public void AddModelError(
	string key,
	string errorMessage
)

Parameters

key
Type: System.String

The key.

errorMessage
Type: System.String

The error message.

Return to top
Show: