Skip to main content
A newer version of this page is available. .

IModelMemberViewItem.MaxLength Property

Specifies the maximum number of characters that can be stored in the database column corresponding to the property displayed by the current Property Editor.

Namespace: DevExpress.ExpressApp.Model

Assembly: DevExpress.ExpressApp.v18.2.dll

Declaration

int MaxLength { get; set; }

Property Value

Type Description
Int32

An integer value specifying the maximum number of characters that can be stored in the database column corresponding to the property displayed by the current Property Editor.

Remarks

This property is considered for string properties. Note that you cannot change the size of a property for which a column is already created in the database. So, this property affects only the creation of a database column.

Note that this attribute only specifies the database column size. The attribute does not prevent users from entering more than the specified number of characters using Property Editors. For instance, suppose you have a string property decorated with the Size attribute that specifies that the corresponding database column’s size must be 10. If a custom Property Editor used to visualize the property allows users to enter more characters, it is perfectly valid for them to do so. In this instance, a SQL exception will be raised when trying to save an object. To ensure that users will not be able to enter and save more than a fixed maximum number of characters, use the Validation Module. For example, you can decorate a business class with RuleCriteriaAttribute, and use the Len function operator to enforce the maximum length for a string property.

See Also