• Share
    • Twitter
    • LinkedIn
    • Facebook
    • Email
  • Feedback
  • Improve this Doc

Class HtmlValidationExtensions

Provides support for validating the input from an HTML form.

Inheritance
System.Object
HtmlValidationExtensions
Namespace: DotNetNuke.Web.Mvc.Helpers
Assembly: DotNetNuke.Web.Mvc.dll
Syntax
public static class HtmlValidationExtensions : object

Methods

| Improve this Doc View Source

Validate(DnnHtmlHelper, String)

Retrieves the validation metadata for the specified model and applies each rule to the data field.

Declaration
public static void Validate(this DnnHtmlHelper html, string modelName)
Parameters
Type Name Description
DnnHtmlHelper html

The HTML helper instance that this method extends.

System.String modelName

The name of the property or model object that is being validated.

Exceptions
Type Condition
System.ArgumentNullException

The modelName parameter is null.

| Improve this Doc View Source

ValidateFor<TModel, TProperty>(DnnHtmlHelper<TModel>, Expression<Func<TModel, TProperty>>)

Retrieves the validation metadata for the specified model and applies each rule to the data field.

Declaration
public static void ValidateFor<TModel, TProperty>(this DnnHtmlHelper<TModel> html, Expression<Func<TModel, TProperty>> expression)
Parameters
Type Name Description
DnnHtmlHelper<TModel> html

The HTML helper instance that this method extends.

Expression<Func<TModel, TProperty>> expression

An expression that identifies the object that contains the properties to render.

Type Parameters
Name Description
TModel

The type of the model.

TProperty

The type of the property.

| Improve this Doc View Source

ValidationMessage(DnnHtmlHelper, String, IDictionary<String, Object>)

Displays a validation message if an error exists for the specified field in the System.Web.Mvc.ModelStateDictionary object.

Declaration
public static MvcHtmlString ValidationMessage(this DnnHtmlHelper html, string modelName, IDictionary<string, object> htmlAttributes)
Parameters
Type Name Description
DnnHtmlHelper html

The HTML helper instance that this method extends.

System.String modelName

The name of the property or model object that is being validated.

IDictionary<System.String, System.Object> htmlAttributes

An object that contains the HTML attributes for the element.

Returns
Type Description
MvcHtmlString

If the property or object is valid, an empty string; otherwise, a span element that contains an error message.

| Improve this Doc View Source

ValidationMessage(DnnHtmlHelper, String, Object)

Displays a validation message if an error exists for the specified field in the System.Web.Mvc.ModelStateDictionary object.

Declaration
public static MvcHtmlString ValidationMessage(this DnnHtmlHelper html, string modelName, object htmlAttributes)
Parameters
Type Name Description
DnnHtmlHelper html

The HTML helper instance that this method extends.

System.String modelName

The name of the property or model object that is being validated.

System.Object htmlAttributes

An object that contains the HTML attributes for the element.

Returns
Type Description
MvcHtmlString

If the property or object is valid, an empty string; otherwise, a span element that contains an error message.

| Improve this Doc View Source

ValidationMessage(DnnHtmlHelper, String, String, IDictionary<String, Object>)

Displays a validation message if an error exists for the specified field in the System.Web.Mvc.ModelStateDictionary object.

Declaration
public static MvcHtmlString ValidationMessage(this DnnHtmlHelper html, string modelName, string validationMessage, IDictionary<string, object> htmlAttributes)
Parameters
Type Name Description
DnnHtmlHelper html

The HTML helper instance that this method extends.

System.String modelName

The name of the property or model object that is being validated.

System.String validationMessage

The message to display if the specified field contains an error.

IDictionary<System.String, System.Object> htmlAttributes

An object that contains the HTML attributes for the element.

Returns
Type Description
MvcHtmlString

If the property or object is valid, an empty string; otherwise, a span element that contains an error message.

| Improve this Doc View Source

ValidationMessage(DnnHtmlHelper, String, String, Object)

Displays a validation message if an error exists for the specified field in the System.Web.Mvc.ModelStateDictionary object.

Declaration
public static MvcHtmlString ValidationMessage(this DnnHtmlHelper html, string modelName, string validationMessage, object htmlAttributes)
Parameters
Type Name Description
DnnHtmlHelper html

The HTML helper instance that this method extends.

System.String modelName

The name of the property or model object that is being validated.

System.String validationMessage

The message to display if the specified field contains an error.

System.Object htmlAttributes

An object that contains the HTML attributes for the element.

Returns
Type Description
MvcHtmlString

If the property or object is valid, an empty string; otherwise, a span element that contains an error message.

| Improve this Doc View Source

ValidationMessage(DnnHtmlHelper, String, String)

Displays a validation message if an error exists for the specified field in the System.Web.Mvc.ModelStateDictionary object.

Declaration
public static MvcHtmlString ValidationMessage(this DnnHtmlHelper html, string modelName, string validationMessage)
Parameters
Type Name Description
DnnHtmlHelper html

The HTML helper instance that this method extends.

System.String modelName

The name of the property or model object that is being validated.

System.String validationMessage

The message to display if the specified field contains an error.

Returns
Type Description
MvcHtmlString

If the property or object is valid, an empty string; otherwise, a span element that contains an error message.

| Improve this Doc View Source

ValidationMessage(DnnHtmlHelper, String)

Displays a validation message if an error exists for the specified field in the System.Web.Mvc.ModelStateDictionary object.

Declaration
public static MvcHtmlString ValidationMessage(this DnnHtmlHelper html, string modelName)
Parameters
Type Name Description
DnnHtmlHelper html

The HTML helper instance that this method extends.

System.String modelName

The name of the property or model object that is being validated.

Returns
Type Description
MvcHtmlString

If the property or object is valid, an empty string; otherwise, a span element that contains an error message.

| Improve this Doc View Source

ValidationMessageFor<TModel, TProperty>(DnnHtmlHelper<TModel>, Expression<Func<TModel, TProperty>>, String, IDictionary<String, Object>)

Returns the HTML markup for a validation-error message for each data field that is represented by the specified expression, using the specified message and HTML attributes.

Declaration
public static MvcHtmlString ValidationMessageFor<TModel, TProperty>(this DnnHtmlHelper<TModel> html, Expression<Func<TModel, TProperty>> expression, string validationMessage, IDictionary<string, object> htmlAttributes)
Parameters
Type Name Description
DnnHtmlHelper<TModel> html

The HTML helper instance that this method extends.

Expression<Func<TModel, TProperty>> expression

An expression that identifies the object that contains the properties to render.

System.String validationMessage

The message to display if the specified field contains an error.

IDictionary<System.String, System.Object> htmlAttributes

An object that contains the HTML attributes for the element.

Returns
Type Description
MvcHtmlString

If the property or object is valid, an empty string; otherwise, a span element that contains an error message.

Type Parameters
Name Description
TModel

The type of the model.

TProperty

The type of the property.

| Improve this Doc View Source

ValidationMessageFor<TModel, TProperty>(DnnHtmlHelper<TModel>, Expression<Func<TModel, TProperty>>, String, Object)

Returns the HTML markup for a validation-error message for each data field that is represented by the specified expression, using the specified message and HTML attributes.

Declaration
public static MvcHtmlString ValidationMessageFor<TModel, TProperty>(this DnnHtmlHelper<TModel> html, Expression<Func<TModel, TProperty>> expression, string validationMessage, object htmlAttributes)
Parameters
Type Name Description
DnnHtmlHelper<TModel> html

The HTML helper instance that this method extends.

Expression<Func<TModel, TProperty>> expression

An expression that identifies the object that contains the properties to render.

System.String validationMessage

The message to display if the specified field contains an error.

System.Object htmlAttributes

An object that contains the HTML attributes for the element.

Returns
Type Description
MvcHtmlString

If the property or object is valid, an empty string; otherwise, a span element that contains an error message.

Type Parameters
Name Description
TModel

The type of the model.

TProperty

The type of the property.

| Improve this Doc View Source

ValidationMessageFor<TModel, TProperty>(DnnHtmlHelper<TModel>, Expression<Func<TModel, TProperty>>, String)

Returns the HTML markup for a validation-error message for each data field that is represented by the specified expression, using the specified message.

Declaration
public static MvcHtmlString ValidationMessageFor<TModel, TProperty>(this DnnHtmlHelper<TModel> html, Expression<Func<TModel, TProperty>> expression, string validationMessage)
Parameters
Type Name Description
DnnHtmlHelper<TModel> html

The HTML helper instance that this method extends.

Expression<Func<TModel, TProperty>> expression

An expression that identifies the object that contains the properties to render.

System.String validationMessage

The message to display if the specified field contains an error.

Returns
Type Description
MvcHtmlString

If the property or object is valid, an empty string; otherwise, a span element that contains an error message.

Type Parameters
Name Description
TModel

The type of the model.

TProperty

The type of the property.

| Improve this Doc View Source

ValidationMessageFor<TModel, TProperty>(DnnHtmlHelper<TModel>, Expression<Func<TModel, TProperty>>)

Returns the HTML markup for a validation-error message for each data field that is represented by the specified expression.

Declaration
public static MvcHtmlString ValidationMessageFor<TModel, TProperty>(this DnnHtmlHelper<TModel> html, Expression<Func<TModel, TProperty>> expression)
Parameters
Type Name Description
DnnHtmlHelper<TModel> html

The HTML helper instance that this method extends.

Expression<Func<TModel, TProperty>> expression

An expression that identifies the object that contains the properties to render.

Returns
Type Description
MvcHtmlString

If the property or object is valid, an empty string; otherwise, a span element that contains an error message.

Type Parameters
Name Description
TModel

The type of the model.

TProperty

The type of the property.

| Improve this Doc View Source

ValidationSummary(DnnHtmlHelper, Boolean, String, IDictionary<String, Object>)

Returns an unordered list (ul element) of validation messages that are in the System.Web.Mvc.ModelStateDictionary object and optionally displays only model-level errors.

Declaration
public static MvcHtmlString ValidationSummary(this DnnHtmlHelper html, bool excludePropertyErrors, string message, IDictionary<string, object> htmlAttributes)
Parameters
Type Name Description
DnnHtmlHelper html

The HTML helper instance that this method extends.

System.Boolean excludePropertyErrors

true to have the summary display model-level errors only, or false to have the summary display all errors.

System.String message

The message to display with the validation summary.

IDictionary<System.String, System.Object> htmlAttributes

A dictionary that contains the HTML attributes for the element.

Returns
Type Description
MvcHtmlString

A string that contains an unordered list (ul element) of validation messages.

| Improve this Doc View Source

ValidationSummary(DnnHtmlHelper, Boolean, String, Object)

Returns an unordered list (ul element) of validation messages that are in the System.Web.Mvc.ModelStateDictionary object and optionally displays only model-level errors.

Declaration
public static MvcHtmlString ValidationSummary(this DnnHtmlHelper html, bool excludePropertyErrors, string message, object htmlAttributes)
Parameters
Type Name Description
DnnHtmlHelper html

The HTML helper instance that this method extends.

System.Boolean excludePropertyErrors

true to have the summary display model-level errors only, or false to have the summary display all errors.

System.String message

The message to display with the validation summary.

System.Object htmlAttributes

An object that contains the HTML attributes for the element.

Returns
Type Description
MvcHtmlString

A string that contains an unordered list (ul element) of validation messages.

| Improve this Doc View Source

ValidationSummary(DnnHtmlHelper, Boolean, String)

Returns an unordered list (ul element) of validation messages that are in the System.Web.Mvc.ModelStateDictionary object and optionally displays only model-level errors.

Declaration
public static MvcHtmlString ValidationSummary(this DnnHtmlHelper html, bool excludePropertyErrors, string message)
Parameters
Type Name Description
DnnHtmlHelper html

The HTML helper instance that this method extends.

System.Boolean excludePropertyErrors

true to have the summary display model-level errors only, or false to have the summary display all errors.

System.String message

The message to display with the validation summary.

Returns
Type Description
MvcHtmlString

A string that contains an unordered list (ul element) of validation messages.

| Improve this Doc View Source

ValidationSummary(DnnHtmlHelper, Boolean)

Returns an unordered list (ul element) of validation messages that are in the System.Web.Mvc.ModelStateDictionary object and optionally displays only model-level errors.

Declaration
public static MvcHtmlString ValidationSummary(this DnnHtmlHelper html, bool excludePropertyErrors)
Parameters
Type Name Description
DnnHtmlHelper html

The HTML helper instance that this method extends.

System.Boolean excludePropertyErrors

true to have the summary display model-level errors only, or false to have the summary display all errors.

Returns
Type Description
MvcHtmlString

A string that contains an unordered list (ul element) of validation messages.

| Improve this Doc View Source

ValidationSummary(DnnHtmlHelper, String, IDictionary<String, Object>)

Returns an unordered list (ul element) of validation messages that are in the System.Web.Mvc.ModelStateDictionary object.

Declaration
public static MvcHtmlString ValidationSummary(this DnnHtmlHelper html, string message, IDictionary<string, object> htmlAttributes)
Parameters
Type Name Description
DnnHtmlHelper html

The HTML helper instance that this method extends.

System.String message

The message to display if the specified field contains an error.

IDictionary<System.String, System.Object> htmlAttributes

A dictionary that contains the HTML attributes for the element.

Returns
Type Description
MvcHtmlString

A string that contains an unordered list (ul element) of validation messages.

| Improve this Doc View Source

ValidationSummary(DnnHtmlHelper, String, Object)

Returns an unordered list (ul element) of validation messages in the System.Web.Mvc.ModelStateDictionary object.

Declaration
public static MvcHtmlString ValidationSummary(this DnnHtmlHelper html, string message, object htmlAttributes)
Parameters
Type Name Description
DnnHtmlHelper html

The HTML helper instance that this method extends.

System.String message

The message to display if the specified field contains an error.

System.Object htmlAttributes

An object that contains the HTML attributes for the element.

Returns
Type Description
MvcHtmlString

A string that contains an unordered list (ul element) of validation messages.

| Improve this Doc View Source

ValidationSummary(DnnHtmlHelper, String)

Returns an unordered list (ul element) of validation messages that are in the System.Web.Mvc.ModelStateDictionary object.

Declaration
public static MvcHtmlString ValidationSummary(this DnnHtmlHelper html, string message)
Parameters
Type Name Description
DnnHtmlHelper html

The HMTL helper instance that this method extends.

System.String message

The message to display if the specified field contains an error.

Returns
Type Description
MvcHtmlString

A string that contains an unordered list (ul element) of validation messages.

| Improve this Doc View Source

ValidationSummary(DnnHtmlHelper)

Returns an unordered list (ul element) of validation messages that are in the System.Web.Mvc.ModelStateDictionary object.

Declaration
public static MvcHtmlString ValidationSummary(this DnnHtmlHelper html)
Parameters
Type Name Description
DnnHtmlHelper html

The HTML helper instance that this method extends.

Returns
Type Description
MvcHtmlString

A string that contains an unordered list (ul element) of validation messages.

  • View Source
Back to top by the community, for the community... #DNNCMS