LabelExtensions¶
Renders a <label> element using a defined text-resolution precedence (explicit text, then display-name metadata, then property name, then the html field name's last segment), suppressing the element entirely when no text can be resolved.
Purpose¶
- Renders a
<label>element using a defined text-resolution precedence (explicit text, then display-name metadata, then property name, then the html field name's last segment), suppressing the element entirely when no text can be resolved.
Context¶
- Namespace:
SAIF.Web.Mvc.Extensions - Assembly/package:
SAIF.Framework.Web.Mvc (source-shipping NuGet package) - Kind: static class
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| LabelFor |
public static MvcHtmlString LabelFor<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression, string labelText = null, object htmlAttributes = null) |
Resolves label text by precedence and renders the label, or returns MvcHtmlString.Empty when no text resolves; see the "Render a label with custom attributes" operation. |
Sources¶
src/Web.Mvc/Extensions/LabelExtensions.cs