Back to Devexpress

Label

aspnetmvc-8989-components-data-editors-extensions-label.md

latest1.7 KB
Original Source

Label

  • Dec 17, 2020
  • 2 minutes to read

Label is a label extension that allows you to display text on a web page.

Implementation Details

Label is a LabelExtension class instance. The ExtensionsFactory.Label helper method allows you to add a Label extension to a view. This method’s parameter provides access to the Label ‘s settings (LabelSettings).

The ASPxClientLabel object is a Label ‘s client counterpart.

Note

Use the Overview - LabelFor extension to specify a label element’s for attribute.

Declaration

The following code snippets illustrate how to add a Label to a view:

razor
@Html.DevExpress().Label(settings => {
    settings.Name = "label1";
    settings.Text = "Some text";
    settings.Properties.EnableClientSideAPI = true;
}).GetHtml()

@Html.DevExpress().Button(settings => {
    settings.Name = "myButton1";
    settings.ClientSideEvents.Click = "function (s, e) {label1.SetText(label1.GetText() + ' New text');}";
}).GetHtml()

Note

The Partial View should contain only the extension’s code.

The image below shows the result.

Main Features

  • Ability to Associate a Label to an Extension

  • Appearance Customization

  • Full-Featured Client-Side API