public static MvcHtmlString ValidationSummary(this HtmlHelper htmlHelper, bool excludePropertyErrors, string message, IDictionary <string, object> htmlAttributes) { if (htmlHelper == null) { throw new ArgumentNullException("htmlHelper"); } var errorStatus = htmlHelper.GetErrorStatus(); if (errorStatus == null || errorStatus.Errors != null && errorStatus.Errors.Count > 0) { return(null); //just show individual field errors } var divTag = new TagBuilder("div"); HtmlHelper.ValidationSummaryCssClassNames.Split(' ').Each(divTag.AddCssClass); divTag.MergeAttributes(htmlAttributes); divTag.InnerHtml = errorStatus.Message; return(divTag.ToMvcHtmlString(TagRenderMode.Normal)); }
public static MvcHtmlString ValidationSuccess(this HtmlHelper htmlHelper, string message, IDictionary <string, object> htmlAttributes) { if (htmlHelper == null) { throw new ArgumentNullException("htmlHelper"); } var errorStatus = htmlHelper.GetErrorStatus(); if (message == null || errorStatus != null || htmlHelper.HttpRequest.HttpMethod == HttpMethods.Get) { return(null); } var divTag = new TagBuilder("div"); HtmlHelper.ValidationSuccessCssClassNames.Split(' ').Each(divTag.AddCssClass); divTag.MergeAttributes(htmlAttributes); divTag.InnerHtml = message; return(divTag.ToMvcHtmlString(TagRenderMode.Normal)); }
public static HtmlString ValidationSummary(this HtmlHelper html, ICollection <string> exceptFields) => ViewUtils.ValidationSummary(html.GetErrorStatus(), exceptFields, null).ToHtmlString();
public static HtmlString ValidationSummary(this HtmlHelper html, ICollection <string> exceptFields, object divAttrs) => ViewUtils.ValidationSummary(html.GetErrorStatus(), exceptFields, divAttrs.ToObjectDictionary()).ToHtmlString();
public static HtmlString ErrorSummary(this HtmlHelper html) => ViewUtils.ValidationSummary(html.GetErrorStatus(), null).ToHtmlString();
/// <summary> /// Alias for ServiceStack Html.ValidationSummary() with comma-delimited field names /// </summary> public static HtmlString ErrorSummary(this HtmlHelper html, string exceptFor) => ViewUtils.ValidationSummary(html.GetErrorStatus(), exceptFor).ToHtmlString();
public static string ErrorResponse(this HtmlHelper html, string fieldName) => ViewUtils.ErrorResponse(html.GetErrorStatus(), fieldName);
public static string ErrorResponseSummary(this HtmlHelper html) => ViewUtils.ErrorResponseSummary(html.GetErrorStatus());
public static string ErrorResponseExcept(this HtmlHelper html, ICollection <string> fieldNames) => ViewUtils.ErrorResponseExcept(html.GetErrorStatus(), fieldNames);