Sdílet prostřednictvím


ModelMetadata.GetSimpleDisplayText Method

Returns the simple description of the model.

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

Syntax

'Declaration
Protected Overridable Function GetSimpleDisplayText As String
protected virtual string GetSimpleDisplayText()
protected:
virtual String^ GetSimpleDisplayText()

Return Value

Type: System.String
The simple description of the model.

Remarks

This method is used to retrieve text to display as an alternative to the description of a complex object. If no value is specified for the SimpleDisplayText property, the value that is returned by this method follows these rules:

  • If the model is null, the method returns the value of the NullDisplayText property.

  • If the type has overridden the ToString method, the method returns the value that is returned by the method override.

  • If the model has no properties, the method returns an empty string.

  • If the model’s first property is null reference (Nothing in Visual Basic), the method returns that property’s NullDisplayText value.

  • Otherwise, the method returns the model’s first property’s string value.

See Also

Reference

ModelMetadata Class

System.Web.Mvc Namespace