http://blogs.msdn.com/b/stuartleeks/archive/2012/05/01/asp-net-mvc-adding-aria-required-attribute-for-required-fields.aspx
@{
var attributes = new RouteValueDictionary
{
{ "class", "text-box single-line"}
};
if (ViewContext.ViewData.ModelMetadata.IsRequired)
{
attributes.Add("aria-required", "true");
}
}
@Html.TextBox("", ViewContext.ViewData.TemplateInfo.FormattedModelValue, attributes)
No comments:
Post a Comment