Может быть что-то между строк:
public static class LabelExtensions
{
public static MvcHtmlString LabelFor<TModel, TProperty>(
this HtmlHelper<TModel> htmlHelper,
Expression<Func<TModel, TProperty>> ex,
object htmlAttributes
)
{
var metadata = ModelMetadata.FromLambdaExpression<TModel, TProperty>(ex, htmlHelper.ViewData);
var htmlFieldName = ExpressionHelper.GetExpressionText(ex);
var labelText = metadata.DisplayName;
if (string.IsNullOrEmpty(labelText))
{
labelText = htmlFieldName.Split('.').Last();
}
if (string.IsNullOrEmpty(labelText))
{
return MvcHtmlString.Empty;
}
var tagBuilder = new TagBuilder("label");
var id = htmlHelper.ViewContext.ViewData.TemplateInfo.GetFullHtmlFieldName(htmlFieldName);
tagBuilder.Attributes.Add("for", id);
var attributes = new RouteValueDictionary(htmlAttributes);
tagBuilder.MergeAttributes(attributes);
tagBuilder.SetInnerText(labelText);
return MvcHtmlString.Create(tagBuilder.ToString(TagRenderMode.Normal));
}
}
, а затем:
<%= Html.LabelFor(x => x.Id, new { @class = "textbox-medium" }) %>