We have a custom HTML helper with the following signature.
public static MvcHtmlString TextBoxFor<TModel,
TProperty>(this HtmlHelper<TModel> helper,
Expression<Func<TModel, TProperty>> property)
{
var htmlAttributes = new Dictionary<string, object>();
// ....
return helper.TextBoxFor(property, htmlAttributes);
}
I would like to implement the placeholder attribute here, which should be set to the label for this control. The label can either be a string constant or the string specified for the property’s [Display] attribute.
Is there any way for me to get this label from this helper function?
This seems to work: