ModelMetadata.IsRequired Property
Gets or sets a value that indicates whether the model is required.
Namespace: System.Web.Mvc
Assembly: System.Web.Mvc (in System.Web.Mvc.dll)
Syntax
'Declaration
Public Overridable Property IsRequired As Boolean
Get
Set
public virtual bool IsRequired { get; set; }
public:
virtual property bool IsRequired {
bool get ();
void set (bool value);
}
Property Value
Type: System.Boolean
true if the model is required; otherwise, false.
Remarks
The default value for this property is true for non-nullable value types and false for all other types.