Mvc.net 2 - Change The Html Outputed By Validationmessagefor - Can This Be Down Via Templates?
MVC.net 2 by default outputs validation messages like this: A Validation message I would li
Solution 1:
The code that generates that html is inside of ValidateExtensions.cs, in System.Web.Mvc. You could update the code to output a label instead of a span and then recompile that. The code looks like the following:
TagBuilderbuilder=newTagBuilder("span");
builder.MergeAttributes(htmlAttributes);
builder.MergeAttribute("class", HtmlHelper.ValidationMessageCssClassName);
builder.SetInnerText(String.IsNullOrEmpty(validationMessage) ? GetUserErrorMessageOrDefault(htmlHelper.ViewContext.HttpContext, modelError, modelState) : validationMessage);
Otherwise, you might be able to override ValidationExtensions.ValidationSummary(this HtmlHelper htmlHelper, string message, IDictionary htmlAttributes) and do it that way...
Post a Comment for "Mvc.net 2 - Change The Html Outputed By Validationmessagefor - Can This Be Down Via Templates?"