Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is the better ASP.NET MVC 3.0 Custom Validation approach
    primarykey
    data
    text
    <p>I am looking into ASP.NET MVC 3.0 custom validation and found some articles about that:</p> <p><strong>First</strong>: <a href="http://tdryan.blogspot.com/2010/12/aspnet-mvc-3-custom-validation.html" rel="nofollow">http://tdryan.blogspot.com/2010/12/aspnet-mvc-3-custom-validation.html</a></p> <p><strong>Second</strong>: <a href="http://thepursuitofalife.com/asp-net-mvc-3-unobtrusive-javascript-validation-with-custom-validators/" rel="nofollow">http://thepursuitofalife.com/asp-net-mvc-3-unobtrusive-javascript-validation-with-custom-validators/</a> </p> <p><strong>Third</strong>: <a href="http://samipoimala.com/it/2010/11/29/unobtrusive-client-validation-in-asp-net-mvc-3/" rel="nofollow">http://samipoimala.com/it/2010/11/29/unobtrusive-client-validation-in-asp-net-mvc-3/</a></p> <p>But each of articles describing a bit different approaches...</p> <p>In the <strong>First</strong> article they creating <code>CustomValidatonAtribute</code> and <code>CustomValidaor</code> Inherited form <code>DataAnnotationsModelValidator&lt;CustomValidatonAtribute&gt;</code>, than they register all that in <code>Global.asx</code>, without any jQuery custom validaton methods.</p> <p>In <strong>Second</strong> article they created just <code>ValidatonAttribute</code> witch implemented <code>IClientValidatable</code> then they crating custom jQueryValidator method on client side.</p> <p>In the <strong>Third</strong> article they crating <code>ModelClientValidator</code> inherited from <code>ModelClientValidationRule</code> plus jQuery custom validator method on client side.</p> <p>It is a bit confusing which approach to pick, but i think o would go with <strong>Third</strong> one first it is looking for me more lightweight that other ones.</p> <p>I know that i may need to try each of them to see how it is looking on practice and looks like it is depends what validation is required.</p> <p>Should i inherit my custom validator from <code>DataAnnotationsModelValidator</code> of from <code>ModelClientValidationRule</code>?</p> <p>But may be some have any opinions on that? </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload