Skip to main content

LabelSettings.AssociatedControlName Property

Gets or sets the name of an element that the Label is associated with.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v24.2.dll

Declaration

public string AssociatedControlName { get; set; }

Property Value

Type Description
String

A string value corresponding to the element name.

Remarks

Use the AssociatedControlName property to associate a control with the Label. On a web page, a browser renders the label as an HTML label element. The label’s “for” attribute is set to the associated control’s ID property.

Concept

Example

@Html.DevExpress().Label(
settings => {
    settings.ControlStyle.CssClass = "label";
    settings.Text = "Product Name:";
    settings.AssociatedControlName = "ProductName";
}).GetHtml()

@Html.DevExpress().TextBox(
    settings => {
        settings.Name = "ProductName";
        settings.ControlStyle.CssClass = "editor";
    }
).Bind(Model.ProductName).GetHtml()
See Also