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.1.dll
NuGet Package: DevExpress.Web.Mvc5
Declaration
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