Bypass Data Annotations validation on ASP.NET MVC 2 -


I would like to know whether it is possible to bypass validation of a property which is using data annotation since I I use a model in many pages, so I need a check in some, but not in others, so I would like to ignore it.

Tux!

You can use fluvant validation, which uses an external valuer class. In this situation, you will apply a different verification class for each scenario.

Example:

  Using FluentValidation; Public category subscribers: Abstraquitator & lt; Customers & gt; {Public Customer Validate (RuleFor (Customer => Customer Name). Notactic (); Rule Farm (Customer => Customer Foreman) .notEmpty (). With the message ("please specify first name"); }} Public Class Customer Wide 2: Abstraquitator & lt; Customers & gt; {Public Customer Validate (RuleFor (Customer => Customer Name). Notactic (); }} Customer Clients = New Customers (); Client Validator Validator = New Customer Visitor (); Validation result result = validator Validity (customer); Customer Validator2 Validator = 2 New Customer Validator2 (); Validation result result 2 = Validator 2 Validity (customer); There will be 2 validation errors in the results 2, there will be 1 verification error for the same customer  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -