Export (0) Print
Expand All

ModelClientValidationRule.ValidationParameters Property

.NET Framework 4

Gets the list of validation parameters.

Namespace:  System.Web.Mvc
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

public IDictionary<string, Object> ValidationParameters { get; }

Property Value

Type: System.Collections.Generic.IDictionary<String, Object>
A list of validation parameters.

The following example shows how the ModelClientValidationRegexRule constructor sets the error message and validation type, and how it adds a regular expression rule.

public class ModelClientValidationRegexRule : ModelClientValidationRule {
    public ModelClientValidationRegexRule(string errorMessage, 
           string pattern) 
    {
        ErrorMessage = errorMessage;
        ValidationType = "regularExpression";
        ValidationParameters.Add("pattern", pattern);
    }
}

Community Additions

ADD
Show:
© 2014 Microsoft