<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"><channel><title>Emad Ibrahim - Latest Comments in Client &amp;amp; Server Side Validation in ASP.NET MVC</title><link>http://emadibrahim.disqus.com/</link><description></description><language>en</language><lastBuildDate>Wed, 03 Jun 2009 11:17:03 -0000</lastBuildDate><item><title>Re: Client &amp;amp; Server Side Validation in ASP.NET MVC</title><link>http://www.emadibrahim.com/2008/09/08/client-server-side-validation-in-aspnet-mvc/#comment-10432579</link><description>There is another validation toolkit called Validator Toolkit for ASP.NET on &lt;a href="http://Codeplex.com" rel="nofollow"&gt;Codeplex.com&lt;/a&gt;. See &lt;a href="http://www.codeplex.com/MvcValidatorToolkit" rel="nofollow"&gt;http://www.codeplex.com/MvcValidatorToolkit&lt;/a&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">fred</dc:creator><pubDate>Wed, 03 Jun 2009 11:17:03 -0000</pubDate></item><item><title>Re: Client &amp;amp; Server Side Validation in ASP.NET MVC</title><link>http://www.emadibrahim.com/2008/09/08/client-server-side-validation-in-aspnet-mvc/#comment-5364900</link><description>Emad,&lt;br&gt;&lt;br&gt;I got past this problem by using System.ComponentModel.DataAnnotations, I am using a feature in Dynamic Data to achieve this (&lt;a href="http://blogs.microsoft.co.il/blogs/noam/archive/2008/05/12/screencast-how-to-work-with-dataannotations-vs2008-sp1-beta.aspx" rel="nofollow"&gt;http://blogs.microsoft.co.il/blogs/noam/archive...&lt;/a&gt;) lucky find, but working well!&lt;br&gt;&lt;br&gt;I had to update my last posted example with a few bigger changes to support this.  My last code still stands if you can add attributes to your model, as said I couldn't as mine was code generated.  I have just outlined the approach I took in my blog (&lt;a href="http://goneale.wordpress.com/2009/01/19/aspnet-mvc-validation-the-definitive-guide-in-my-eyes/" rel="nofollow"&gt;http://goneale.wordpress.com/2009/01/19/aspnet-...&lt;/a&gt;) rather than spamming yours. :)</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Graham</dc:creator><pubDate>Mon, 19 Jan 2009 08:47:00 -0000</pubDate></item><item><title>Re: Client &amp;amp; Server Side Validation in ASP.NET MVC</title><link>http://www.emadibrahim.com/2008/09/08/client-server-side-validation-in-aspnet-mvc/#comment-5323394</link><description>Hi All,&lt;br&gt;&lt;br&gt;Emad, I hope you don't mind but I have proposed a change to your code at this point:&lt;br&gt;&lt;br&gt;signature declaration:&lt;br&gt;&lt;code&gt;&lt;br&gt;        public static string ClientSideValidation(this HtmlHelper htmlHelper,&lt;br&gt;                                                  string formName,&lt;br&gt;                                                  object modelToValidate,&lt;br&gt;                                                  bool prefixWithModelName)&lt;br&gt;&lt;/code&gt;&lt;br&gt;&lt;br&gt;and string builder:&lt;br&gt;&lt;br&gt;This caters for typical Model Binding scenarios where you include the model name as a prefix with a dot "." and as a jquery validator plugin requirement, we need double quotes " " as seen here: &lt;a href="http://docs.jquery.com/Plugins/Validation/Reference#Fields_with_complex_names_.28brackets.2C_dots.29" rel="nofollow"&gt;http://docs.jquery.com/Plugins/Validation/Refer...&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;code&gt;&lt;br&gt;rules.AppendLine();&lt;br&gt;                    messages.AppendLine();&lt;br&gt;&lt;b&gt;&lt;br&gt;                    string field = (prefixWithModelName ? "\"" + modelToValidate.GetType().Name + "." + prop.Name + "\"" : prop.Name);&lt;br&gt;                    rules.AppendFormat("{0}: {1}", field, "{");&lt;br&gt;                    messages.AppendFormat("{0}: {1}", field, "{");&lt;br&gt;&lt;/b&gt;&lt;br&gt;                    rules.AppendLine();&lt;br&gt;                    messages.AppendLine();&lt;br&gt;&lt;/code&gt;&lt;br&gt;&lt;br&gt;I also made a change to leave fields as is without ToLower() to comply with my forms and class naming standard.&lt;br&gt;I suppose to remove complexity entirely, all names could just be wrapped in double quotes though.  Shrug.&lt;br&gt;&lt;br&gt;This is working well for me.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Graham</dc:creator><pubDate>Mon, 19 Jan 2009 01:17:24 -0000</pubDate></item><item><title>Re: Client &amp;amp; Server Side Validation in ASP.NET MVC</title><link>http://www.emadibrahim.com/2008/09/08/client-server-side-validation-in-aspnet-mvc/#comment-5274674</link><description>I am not sure what to do here.  That is the problem with generated code and&lt;br&gt;it is the same problem with using LINQ 2 SQL, you can't add attributes to&lt;br&gt;the generated code.&lt;br&gt;-Emad</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">eibrahim</dc:creator><pubDate>Sun, 18 Jan 2009 21:29:15 -0000</pubDate></item><item><title>Re: Client &amp;amp; Server Side Validation in ASP.NET MVC</title><link>http://www.emadibrahim.com/2008/09/08/client-server-side-validation-in-aspnet-mvc/#comment-5273970</link><description>Hey Emad,&lt;br&gt;&lt;br&gt;Great work.  I have a similiar issue to Jeremy's, but I am also doing what you are doing and abstracting the L2S data layer out and upkeeping my own model's.  However I cannot set an attribute on the model to declare the validation rules as my model classes are being generated from CodeSmith.... yikes.  What can I do so I can set this rules? Any ideas?</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Graham</dc:creator><pubDate>Sun, 18 Jan 2009 21:23:31 -0000</pubDate></item><item><title>Re: Client &amp;amp; Server Side Validation in ASP.NET MVC</title><link>http://www.emadibrahim.com/2008/09/08/client-server-side-validation-in-aspnet-mvc/#comment-4289445</link><description>I have updated the source code to compile and work with MVC Beta 1.  Get it from the google project page at &lt;a href="http://code.google.com/p/mvcvalidation/" rel="nofollow"&gt;http://code.google.com/p/mvcvalidation/&lt;/a&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">eibrahim</dc:creator><pubDate>Tue, 09 Dec 2008 10:46:59 -0000</pubDate></item><item><title>Re: Client &amp;amp; Server Side Validation in ASP.NET MVC</title><link>http://www.emadibrahim.com/2008/09/08/client-server-side-validation-in-aspnet-mvc/#comment-4289126</link><description>I think that code was written using MVC Preview 5.  You will have to modify&lt;br&gt;it to work with the Beta.&lt;br&gt;I like using the DataAnnotations namespace instead and have switched to it&lt;br&gt;in one of my projects.&lt;br&gt;&lt;br&gt;I use POCO classes for models but I write conversion functions that convert&lt;br&gt;and from my POCO to my LINQ to SQL entities.  Some grunt work but works&lt;br&gt;well.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">eibrahim</dc:creator><pubDate>Tue, 09 Dec 2008 09:28:19 -0000</pubDate></item><item><title>Re: Client &amp;amp; Server Side Validation in ASP.NET MVC</title><link>http://www.emadibrahim.com/2008/09/08/client-server-side-validation-in-aspnet-mvc/#comment-4287057</link><description>First off this is a great idea but It did not compile for me with MVC Beta1 - I posted an issue on this to the project.&lt;br&gt;btw I'm looking at modifying it to use System.ComponentModel.DataAnnotations instead of castle as then I can put the validation attributes in a metadata class instead of the class to be validated. My classes are generated so putting attributes on the fields is not an option.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jeremy Thomas</dc:creator><pubDate>Tue, 09 Dec 2008 07:12:41 -0000</pubDate></item><item><title>Re: Client &amp;amp; Server Side Validation in ASP.NET MVC</title><link>http://www.emadibrahim.com/2008/09/08/client-server-side-validation-in-aspnet-mvc/#comment-4286791</link><description>It did not compile for me with MVC Beta1 - I posted an issue on this to the project. &lt;br&gt;btw I'm looking at modifying it to use System.ComponentModel.DataAnnotations instead of castle as then I can put the validation attributes in a metadata class instead of the class to be validated. My classes are generated so putting attributes on the fields is not an option.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jeremy Thomas</dc:creator><pubDate>Tue, 09 Dec 2008 06:48:55 -0000</pubDate></item><item><title>Re: Client &amp;amp; Server Side Validation in ASP.NET MVC</title><link>http://www.emadibrahim.com/2008/09/08/client-server-side-validation-in-aspnet-mvc/#comment-3975610</link><description>It's working fine for me.  Did you see the instructions at&lt;br&gt;&lt;a href="http://code.google.com/p/mvcvalidation/source/checkout" rel="nofollow"&gt;http://code.google.com/p/mvcvalidation/source/c...&lt;/a&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">eibrahim</dc:creator><pubDate>Sun, 23 Nov 2008 19:35:33 -0000</pubDate></item><item><title>Re: Client &amp;amp; Server Side Validation in ASP.NET MVC</title><link>http://www.emadibrahim.com/2008/09/08/client-server-side-validation-in-aspnet-mvc/#comment-3970809</link><description>I couldn't receive code from Google SVN repository! Anything wrong with SVN URL on Google Code?</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mahdi Taghizadeh</dc:creator><pubDate>Sun, 23 Nov 2008 14:33:27 -0000</pubDate></item><item><title>Re: Client &amp;amp; Server Side Validation in ASP.NET MVC</title><link>http://www.emadibrahim.com/2008/09/08/client-server-side-validation-in-aspnet-mvc/#comment-3878300</link><description>Nice work, I like the optimisation of the writting of the client side validation.. but i do not like to be able to create an instance of the entities before validate with Castle.. I am trying to change this by a FormCollection...</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">jb</dc:creator><pubDate>Tue, 18 Nov 2008 11:01:31 -0000</pubDate></item><item><title>Re: Client &amp;amp; Server Side Validation in ASP.NET MVC</title><link>http://www.emadibrahim.com/2008/09/08/client-server-side-validation-in-aspnet-mvc/#comment-2294856</link><description>I put it on google code because I wanted to try it out..  It's at &lt;a href="http://code.google.com/p/mvcvalidation/" rel="nofollow"&gt;http://code.google.com/p/mvcvalidation/&lt;/a&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">eibrahim</dc:creator><pubDate>Thu, 11 Sep 2008 21:23:29 -0000</pubDate></item><item><title>Re: Client &amp;amp; Server Side Validation in ASP.NET MVC</title><link>http://www.emadibrahim.com/2008/09/08/client-server-side-validation-in-aspnet-mvc/#comment-2276450</link><description>Nice work on this.  I have just been digging into this plugin and the helper is a great idea.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Eric Hexter</dc:creator><pubDate>Wed, 10 Sep 2008 21:59:42 -0000</pubDate></item><item><title>Re: Client &amp;amp; Server Side Validation in ASP.NET MVC</title><link>http://www.emadibrahim.com/2008/09/08/client-server-side-validation-in-aspnet-mvc/#comment-2270584</link><description>Actually, it is pretty easy to do with jQuery's Validation plugin.  One of&lt;br&gt;the validators allows you to make a remote call...  so you can easily call&lt;br&gt;an action that checks if a username is unique and return a json result for&lt;br&gt;the jquery script to parse...  I haven't done it but check the plugin&lt;br&gt;documentation for examples.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">eibrahim</dc:creator><pubDate>Wed, 10 Sep 2008 16:55:10 -0000</pubDate></item><item><title>Re: Client &amp;amp; Server Side Validation in ASP.NET MVC</title><link>http://www.emadibrahim.com/2008/09/08/client-server-side-validation-in-aspnet-mvc/#comment-2270496</link><description>I like this solution but it can't really validate some things, i.e. unique username..etc.  It would be interesting to create an auto-ajax validator to go with &lt;a href="http://asp.net" rel="nofollow"&gt;asp.net&lt;/a&gt; mvc.  In theory we could create a custom attribute that mapped a property to a an implementation of an interface and calls a HttpModule that knows how to look up that properties implementation of an interface and validate to see if the property is correct.  Anyway...it might be way overkill, but I think this could be very useful in the long run.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">justin</dc:creator><pubDate>Wed, 10 Sep 2008 16:48:45 -0000</pubDate></item><item><title>Re: Client &amp;amp; Server Side Validation in ASP.NET MVC</title><link>http://www.emadibrahim.com/2008/09/08/client-server-side-validation-in-aspnet-mvc/#comment-2261554</link><description>Emad -- This is great! I really like how you integrated JQuery to do client-side validation.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Stephen Walther</dc:creator><pubDate>Wed, 10 Sep 2008 12:42:21 -0000</pubDate></item><item><title>Re: Client &amp;amp; Server Side Validation in ASP.NET MVC</title><link>http://www.emadibrahim.com/2008/09/08/client-server-side-validation-in-aspnet-mvc/#comment-2259811</link><description>That is very nice... I implemented some of the livevalidation from Steve Sanderson. I like what you have done w/ it using Preview 5. I look forward to digging through your post in more detail!</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Elijah Manor</dc:creator><pubDate>Wed, 10 Sep 2008 10:34:16 -0000</pubDate></item><item><title>Re: Client &amp;amp; Server Side Validation in ASP.NET MVC</title><link>http://www.emadibrahim.com/2008/09/08/client-server-side-validation-in-aspnet-mvc/#comment-2259251</link><description>Thanks and glad to get some 3rd-party validation (no pun intended) for my design.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">eibrahim</dc:creator><pubDate>Wed, 10 Sep 2008 09:48:32 -0000</pubDate></item><item><title>Re: Client &amp;amp; Server Side Validation in ASP.NET MVC</title><link>http://www.emadibrahim.com/2008/09/08/client-server-side-validation-in-aspnet-mvc/#comment-2258787</link><description>Great code!&lt;br&gt;&lt;br&gt;Put this on CodePlex</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Domagoj Barisic</dc:creator><pubDate>Wed, 10 Sep 2008 09:07:52 -0000</pubDate></item><item><title>Re: Client &amp;amp; Server Side Validation in ASP.NET MVC</title><link>http://www.emadibrahim.com/2008/09/08/client-server-side-validation-in-aspnet-mvc/#comment-2258567</link><description>Thanks.  The current title is "ASP.NET MVC Test Driven Development Problem Design Solution" and the publisher is Wrox.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">eibrahim</dc:creator><pubDate>Wed, 10 Sep 2008 08:41:25 -0000</pubDate></item><item><title>Re: Client &amp;amp; Server Side Validation in ASP.NET MVC</title><link>http://www.emadibrahim.com/2008/09/08/client-server-side-validation-in-aspnet-mvc/#comment-2258549</link><description>Check out setve's post and code, he uses livevalidation&lt;br&gt;&lt;a href="http://blog.codeville.net/2008/04/30/model-based-client-side-validation-for-aspnet-mvc/" rel="nofollow"&gt;http://blog.codeville.net/2008/04/30/model-base...&lt;/a&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">eibrahim</dc:creator><pubDate>Wed, 10 Sep 2008 08:39:37 -0000</pubDate></item><item><title>Re: Client &amp;amp; Server Side Validation in ASP.NET MVC</title><link>http://www.emadibrahim.com/2008/09/08/client-server-side-validation-in-aspnet-mvc/#comment-2256433</link><description>Nice and helpful post. But I've one question, if I want to use &lt;a href="http://www.livevalidation.com/" rel="nofollow"&gt;livevalidation&lt;/a&gt; or other validation javascript then what should I do?</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jahedur Rahman</dc:creator><pubDate>Wed, 10 Sep 2008 01:21:33 -0000</pubDate></item><item><title>Re: Client &amp;amp; Server Side Validation in ASP.NET MVC</title><link>http://www.emadibrahim.com/2008/09/08/client-server-side-validation-in-aspnet-mvc/#comment-2256361</link><description>HI Emad ,&lt;br&gt;&lt;br&gt;Nice post and looking good.&lt;br&gt;Which book your writing?</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Shiju Varghese</dc:creator><pubDate>Wed, 10 Sep 2008 01:07:06 -0000</pubDate></item><item><title>Re: Client &amp;amp; Server Side Validation in ASP.NET MVC</title><link>http://www.emadibrahim.com/2008/09/08/client-server-side-validation-in-aspnet-mvc/#comment-2253064</link><description>Emad - I think this stuff is looking promising.  You have made the correct choice of inserting the JavaScript rules (as opposed to using classes to decorate the fields for two reasons I think:-&lt;br&gt;&lt;br&gt;CSS classes should be used for styling and grouping similar elements e.g. you could be using the class attribute already to style certain form elements or maybe using it to group specific elements which can then be manipulated with CSS or JavaScript jQuery etc.  If you had used the class method for tagging the elements, you would have limited peoples use of them for other important reasons - so good choice :)&lt;br&gt;&lt;br&gt;We've rolled out a similar system (also based on Steve Sanderson's excellent work) and it's working well and is proving to be robust  and extensible.&lt;br&gt;&lt;br&gt;Keep up the great work and looking forward to reading your book :)&lt;br&gt;&lt;br&gt;Mike</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mike Stokes</dc:creator><pubDate>Tue, 09 Sep 2008 19:03:38 -0000</pubDate></item></channel></rss>