ModelStateDictionary.AddModelError Method (String, String)

.NET Framework (current version)
 

Adds the specified model error to the errors collection using the specified key and using the specified error message string for the value.

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

public void AddModelError(
	string key,
	string errorMessage
)

Parameters

key
Type: System.String

The key.

errorMessage
Type: System.String

The error message.

Exception Condition
ArgumentNullException

The key parameter is null.

.NET Framework
Available since 4.5
Return to top
Show: