LabelFor is a label extension capable of displaying text on a web page.

Implementation Details

LabelFor is realized by the LabelExtension class. Its instance can be accessed via the ExtensionsFactory<ModelType>.LabelFor<ValueType> helper method, which is used to add a LabelFor extension to a view. This first method's parameter is an expression that identifies model property to display. The second method's parameter provides access to the LabelFor's settings, implemented by the LabelSettings class, allowing you to fully customize the extension.

LabelFor's client counterpart is represented by the ASPxClientLabel object.


LabelFor can be added to a view in the following manner.

@Html.DevExpress().LabelFor(model => model.FontFamily, settings => { settings.Width = 100; }).GetHtml() 

The code result is demonstrated in the image below.


See Also