HtmlHelperValidationExtensions Class¶
Summary¶
Validation-related extensions for [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) and [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper`1](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper`1.yml).
Methods¶
-
ValidationMessage
(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String)¶ Returns the validation message if an error exists in the [Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary]() object for the specified <paramref name=”expression” />.
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- expression (System.String) – Expression name, relative to the current model.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing a [Microsoft.AspNet.Mvc.ViewContext.ValidationMessageElement](Microsoft.AspNet.Mvc.ViewContext.yml) element. <c>null</c> if the <paramref name=”expression” /> is valid and client-side validation is disabled.
public static HtmlString ValidationMessage(IHtmlHelper htmlHelper, string expression)
-
ValidationMessage
(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String, System.Object) Returns the validation message if an error exists in the [Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary]() object for the specified <paramref name=”expression” />.
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- expression (System.String) – Expression name, relative to the current model.
- htmlAttributes (System.Object) – An [System.Object]() that contains the HTML attributes for the ([Microsoft.AspNet.Mvc.ViewContext.ValidationMessageElement](Microsoft.AspNet.Mvc.ViewContext.yml)) element. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the HTML attributes.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing a [Microsoft.AspNet.Mvc.ViewContext.ValidationMessageElement](Microsoft.AspNet.Mvc.ViewContext.yml) element. <c>null</c> if the <paramref name=”expression” /> is valid and client-side validation is disabled.
public static HtmlString ValidationMessage(IHtmlHelper htmlHelper, string expression, object htmlAttributes)
-
ValidationMessage
(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String, System.String) Returns the validation message if an error exists in the [Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary]() object for the specified <paramref name=”expression” />.
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- expression (System.String) – Expression name, relative to the current model.
- message (System.String) – The message to be displayed. If <c>null</c> or empty, method extracts an error string from the [Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary]() object. Message will always be visible but client-side validation may update the associated CSS class.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing a [Microsoft.AspNet.Mvc.ViewContext.ValidationMessageElement](Microsoft.AspNet.Mvc.ViewContext.yml) element. <c>null</c> if the <paramref name=”expression” /> is valid and client-side validation is disabled.
public static HtmlString ValidationMessage(IHtmlHelper htmlHelper, string expression, string message)
-
ValidationMessage
(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String, System.String, System.Object) Returns the validation message if an error exists in the [Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary]() object for the specified <paramref name=”expression” />.
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- expression (System.String) – Expression name, relative to the current model.
- message (System.String) – The message to be displayed. If <c>null</c> or empty, method extracts an error string from the [Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary]() object. Message will always be visible but client-side validation may update the associated CSS class.
- htmlAttributes (System.Object) – An [System.Object]() that contains the HTML attributes for the ([Microsoft.AspNet.Mvc.ViewContext.ValidationMessageElement](Microsoft.AspNet.Mvc.ViewContext.yml)) element. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the HTML attributes.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing a [Microsoft.AspNet.Mvc.ViewContext.ValidationMessageElement](Microsoft.AspNet.Mvc.ViewContext.yml) element. <c>null</c> if the <paramref name=”expression” /> is valid and client-side validation is disabled.
public static HtmlString ValidationMessage(IHtmlHelper htmlHelper, string expression, string message, object htmlAttributes)
-
ValidationMessage
(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String, System.String, System.String) Returns the validation message if an error exists in the [Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary]() object for the specified <paramref name=”expression” />.
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- expression (System.String) – Expression name, relative to the current model.
- message (System.String) – The message to be displayed. If <c>null</c> or empty, method extracts an error string from the [Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary]() object. Message will always be visible but client-side validation may update the associated CSS class.
- tag (System.String) – The tag to wrap the <paramref name=”message” /> in the generated HTML. Its default value is [Microsoft.AspNet.Mvc.ViewContext.ValidationMessageElement](Microsoft.AspNet.Mvc.ViewContext.yml).
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing a <paramref name=”tag” /> element. <c>null</c> if the <paramref name=”expression” /> is valid and client-side validation is disabled.
public static HtmlString ValidationMessage(IHtmlHelper htmlHelper, string expression, string message, string tag)
-
Microsoft.AspNet.Mvc.Rendering.HtmlHelperValidationExtensions.ValidationMessageFor<TModel, TResult>(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel, TResult>>)
Returns the validation message if an error exists in the [Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary]() object for the specified <paramref name=”expression” />.
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper{{TModel}}) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- expression (System.Linq.Expressions.Expression{System.Func{{TModel},{TResult}}}) – An expression to be evaluated against the current model.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing a [Microsoft.AspNet.Mvc.ViewContext.ValidationMessageElement](Microsoft.AspNet.Mvc.ViewContext.yml) element. <c>null</c> if the <paramref name=”expression” /> is valid and client-side validation is disabled.
public static HtmlString ValidationMessageFor<TModel, TResult>(IHtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TResult>> expression)
-
Microsoft.AspNet.Mvc.Rendering.HtmlHelperValidationExtensions.ValidationMessageFor<TModel, TResult>(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.String)
Returns the validation message if an error exists in the [Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary]() object for the specified <paramref name=”expression” />.
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper{{TModel}}) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- expression (System.Linq.Expressions.Expression{System.Func{{TModel},{TResult}}}) – An expression to be evaluated against the current model.
- message (System.String) – The message to be displayed. If <c>null</c> or empty, method extracts an error string from the [Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary]() object. Message will always be visible but client-side validation may update the associated CSS class.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing a [Microsoft.AspNet.Mvc.ViewContext.ValidationMessageElement](Microsoft.AspNet.Mvc.ViewContext.yml) element. <c>null</c> if the <paramref name=”expression” /> is valid and client-side validation is disabled.
public static HtmlString ValidationMessageFor<TModel, TResult>(IHtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TResult>> expression, string message)
-
Microsoft.AspNet.Mvc.Rendering.HtmlHelperValidationExtensions.ValidationMessageFor<TModel, TResult>(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.String, System.Object)
Returns the validation message if an error exists in the [Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary]() object for the specified <paramref name=”expression” />.
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper{{TModel}}) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- expression (System.Linq.Expressions.Expression{System.Func{{TModel},{TResult}}}) – An expression to be evaluated against the current model.
- message (System.String) – The message to be displayed. If <c>null</c> or empty, method extracts an error string from the [Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary]() object. Message will always be visible but client-side validation may update the associated CSS class.
- htmlAttributes (System.Object) – An [System.Object]() that contains the HTML attributes for the ([Microsoft.AspNet.Mvc.ViewContext.ValidationMessageElement](Microsoft.AspNet.Mvc.ViewContext.yml)) element. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the HTML attributes.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing a [Microsoft.AspNet.Mvc.ViewContext.ValidationMessageElement](Microsoft.AspNet.Mvc.ViewContext.yml) element. <c>null</c> if the <paramref name=”expression” /> is valid and client-side validation is disabled.
public static HtmlString ValidationMessageFor<TModel, TResult>(IHtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TResult>> expression, string message, object htmlAttributes)
-
Microsoft.AspNet.Mvc.Rendering.HtmlHelperValidationExtensions.ValidationMessageFor<TModel, TResult>(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.String, System.String)
Returns the validation message if an error exists in the [Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary]() object for the specified <paramref name=”expression” />.
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper{{TModel}}) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- expression (System.Linq.Expressions.Expression{System.Func{{TModel},{TResult}}}) – An expression to be evaluated against the current model.
- message (System.String) – The message to be displayed. If <c>null</c> or empty, method extracts an error string from the [Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary]() object. Message will always be visible but client-side validation may update the associated CSS class.
- tag (System.String) – The tag to wrap the <paramref name=”message” /> in the generated HTML. Its default value is [Microsoft.AspNet.Mvc.ViewContext.ValidationMessageElement](Microsoft.AspNet.Mvc.ViewContext.yml).
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: A new [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing the <paramref name=”tag” /> element. <c>null</c> if the <paramref name=”expression” /> is valid and client-side validation is disabled.
public static HtmlString ValidationMessageFor<TModel, TResult>(IHtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TResult>> expression, string message, string tag)
-
ValidationSummary
(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper)¶ Returns an unordered list (<ul> element) of validation messages that are in the [Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary]() object.
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: New [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing a <div> element wrapping the <ul> element. [Microsoft.AspNet.Mvc.Rendering.HtmlString.Empty](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) if the current model is valid and client-side validation is disabled).
public static HtmlString ValidationSummary(IHtmlHelper htmlHelper)
-
ValidationSummary
(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.Boolean) Returns an unordered list (<ul> element) of validation messages that are in the [Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary]() object.
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- excludePropertyErrors (System.Boolean) – If <c>true</c>, display model-level errors only; otherwise display all errors.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: New [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing a <div> element wrapping the <ul> element. [Microsoft.AspNet.Mvc.Rendering.HtmlString.Empty](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) if the current model is valid and client-side validation is disabled).
public static HtmlString ValidationSummary(IHtmlHelper htmlHelper, bool excludePropertyErrors)
-
ValidationSummary
(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.Boolean, System.String) Returns an unordered list (<ul> element) of validation messages that are in the [Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary]() object.
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- excludePropertyErrors (System.Boolean) – If <c>true</c>, display model-level errors only; otherwise display all errors.
- message (System.String) – The message to display with the validation summary.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: New [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing a <div> element wrapping the [Microsoft.AspNet.Mvc.ViewContext.ValidationSummaryMessageElement](Microsoft.AspNet.Mvc.ViewContext.yml) element (which, in turn, wraps the <paramref name=”message” />) and the <ul> element. [Microsoft.AspNet.Mvc.Rendering.HtmlString.Empty](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) if the current model is valid and client-side validation is disabled).
public static HtmlString ValidationSummary(IHtmlHelper htmlHelper, bool excludePropertyErrors, string message)
-
ValidationSummary
(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.Boolean, System.String, System.Object) Returns an unordered list (<ul> element) of validation messages that are in the [Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary]() object.
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- excludePropertyErrors (System.Boolean) – If <c>true</c>, display model-level errors only; otherwise display all errors.
- message (System.String) – The message to display with the validation summary.
- htmlAttributes (System.Object) – An [System.Object]() that contains the HTML attributes for the topmost (<div>) element. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the HTML attributes.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: New [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing a <div> element wrapping the [Microsoft.AspNet.Mvc.ViewContext.ValidationSummaryMessageElement](Microsoft.AspNet.Mvc.ViewContext.yml) element (which wraps the <paramref name=”message” />) and the <ul> element. [Microsoft.AspNet.Mvc.Rendering.HtmlString.Empty](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) if the current model is valid and client-side validation is disabled).
public static HtmlString ValidationSummary(IHtmlHelper htmlHelper, bool excludePropertyErrors, string message, object htmlAttributes)
-
ValidationSummary
(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.Boolean, System.String, System.String) Returns an unordered list (<ul> element) of validation messages that are in the [Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary]() object.
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- excludePropertyErrors (System.Boolean) – If <c>true</c>, display model-level errors only; otherwise display all errors.
- message (System.String) – The message to display with the validation summary.
- tag (System.String) – The tag to wrap the <paramref name=”message” /> in the generated HTML. Its default value is [Microsoft.AspNet.Mvc.ViewContext.ValidationSummaryMessageElement](Microsoft.AspNet.Mvc.ViewContext.yml).
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: New [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing a <div> element wrapping the <paramref name=”tag” /> element and the <ul> element. [Microsoft.AspNet.Mvc.Rendering.HtmlString.Empty](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) if the current model is valid and client-side validation is disabled).
public static HtmlString ValidationSummary(IHtmlHelper htmlHelper, bool excludePropertyErrors, string message, string tag)
-
ValidationSummary
(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String) Returns an unordered list (<ul> element) of validation messages that are in the [Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary]() object.
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- message (System.String) – The message to display with the validation summary.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: New [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing a <div> element wrapping the [Microsoft.AspNet.Mvc.ViewContext.ValidationSummaryMessageElement](Microsoft.AspNet.Mvc.ViewContext.yml) element (which wraps the <paramref name=”message” />) and the <ul> element. [Microsoft.AspNet.Mvc.Rendering.HtmlString.Empty](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) if the current model is valid and client-side validation is disabled).
public static HtmlString ValidationSummary(IHtmlHelper htmlHelper, string message)
-
ValidationSummary
(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String, System.Object) Returns an unordered list (<ul> element) of validation messages that are in the [Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary]() object.
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- message (System.String) – The message to display with the validation summary.
- htmlAttributes (System.Object) – An [System.Object]() that contains the HTML attributes for the topmost (<div>) element. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the HTML attributes.
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: New [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing a <div> element wrapping the [Microsoft.AspNet.Mvc.ViewContext.ValidationSummaryMessageElement](Microsoft.AspNet.Mvc.ViewContext.yml) element (which wraps the <paramref name=”message” />) and the <ul> element. [Microsoft.AspNet.Mvc.Rendering.HtmlString.Empty](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) if the current model is valid and client-side validation is disabled).
public static HtmlString ValidationSummary(IHtmlHelper htmlHelper, string message, object htmlAttributes)
-
ValidationSummary
(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String, System.Object, System.String) Returns an unordered list (<ul> element) of validation messages that are in the [Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary]() object.
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- message (System.String) – The message to display with the validation summary.
- htmlAttributes (System.Object) – An [System.Object]() that contains the HTML attributes for the topmost (<div>) element. Alternatively, an [System.Collections.Generic.IDictionary`2]() instance containing the HTML attributes.
- tag (System.String) – The tag to wrap the <paramref name=”message” /> in the generated HTML. Its default value is [Microsoft.AspNet.Mvc.ViewContext.ValidationSummaryMessageElement](Microsoft.AspNet.Mvc.ViewContext.yml).
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: New [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing a <div> element wrapping the <paramref name=”tag” /> element and the <ul> element. [Microsoft.AspNet.Mvc.Rendering.HtmlString.Empty](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) if the current model is valid and client-side validation is disabled).
public static HtmlString ValidationSummary(IHtmlHelper htmlHelper, string message, object htmlAttributes, string tag)
-
ValidationSummary
(Microsoft.AspNet.Mvc.Rendering.IHtmlHelper, System.String, System.String) Returns an unordered list (<ul> element) of validation messages that are in the [Microsoft.AspNet.Mvc.ModelBinding.ModelStateDictionary]() object.
Arguments: - htmlHelper (Microsoft.AspNet.Mvc.Rendering.IHtmlHelper) – The [Microsoft.AspNet.Mvc.Rendering.IHtmlHelper](Microsoft.AspNet.Mvc.Rendering.IHtmlHelper.yml) instance this method extends.
- message (System.String) – The message to display with the validation summary.
- tag (System.String) – The tag to wrap the <paramref name=”message” /> in the generated HTML. Its default value is [Microsoft.AspNet.Mvc.ViewContext.ValidationSummaryMessageElement](Microsoft.AspNet.Mvc.ViewContext.yml).
Return type: Microsoft.AspNet.Mvc.Rendering.HtmlString
Returns: New [Microsoft.AspNet.Mvc.Rendering.HtmlString](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) containing a <div> element wrapping the <paramref name=”tag” /> element and the <ul> element. [Microsoft.AspNet.Mvc.Rendering.HtmlString.Empty](Microsoft.AspNet.Mvc.Rendering.HtmlString.yml) if the current model is valid and client-side validation is disabled).
public static HtmlString ValidationSummary(IHtmlHelper htmlHelper, string message, string tag)
-