Back to Devexpress

LabelSettings.AssociatedControlName Property

aspnetmvc-devexpress-dot-web-dot-mvc-dot-labelsettings-41193222.md

latest2.0 KB
Original Source

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.v25.2.dll

NuGet Package : DevExpress.Web.Mvc5

Declaration

csharp
public string AssociatedControlName { get; set; }
vb
Public Property AssociatedControlName As String

Property Value

TypeDescription
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

csharp
@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

Label

LabelSettings Class

LabelSettings Members

DevExpress.Web.Mvc Namespace