<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Validating with the IDataErrorInfo Interface</title><link>http://asp.net</link><pubDate>Sun, 03 Apr 2011 02:45:43 GMT</pubDate><generator>umbraco</generator><description>Comments for Validating with the IDataErrorInfo Interface</description><language>en</language><atom:link href="http://asp.net/rss/comments/27582" rel="self" type="application/rss+xml" /><item><title>Comment Posted by renan.lifestyle</title><link>http://asp.net/mvc/tutorials/older-versions/models-(data)/validating-with-the-idataerrorinfo-interface-cs</link><pubDate>Wed, 29 Dec 2010 20:52:34 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000011353</guid><description><![CDATA[ <p>Nice tutz !</p><p></p><p>But one question, how to display de _error in html?</p>]]></description><enclosure length="0" type="image/png" url="http://i2.asp.net/avatar/renan.lifestyle.jpg?forceidenticon=false&amp;dt=635045143200000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by NTurnbullJr</title><link>http://asp.net/mvc/tutorials/older-versions/models-(data)/validating-with-the-idataerrorinfo-interface-cs</link><pubDate>Tue, 15 Mar 2011 12:17:45 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000012472</guid><description><![CDATA[ <p>I have been over and over the tutorial comparing it with my code but I am still getting the following error:</p><p>Error	3	No defining declaration found for implementing declaration of partial method &#39;MvcScorecardEdmCSharp.Models.Measure.OnMeasureTitleChanging(string)&#39;	C:\Visual Studio 2010\Projects\MvcScorecardEdmCSharp\MvcScorecardEdmCSharp\Models\Measure.cs	9	22	MvcScorecardEdmCSharp</p><p></p><p>My code is listed below. I think it is acting like it does not realize that I have implemented&#160;the IDataError interface so it is removing the On...Changing method in the EMD class? Any ideas on what my problem is? Thanks.</p><p></p><p>using System.Collections.Generic;</p><p>using System.ComponentModel;    //satisfies reference to IDataErrorInfo</p><p>namespace MvcScorecardEdmCSharp.Models</p><p>{</p><p>    public partial class Measure : IDataErrorInfo</p><p>    {</p><p>        private Dictionary&lt;string, string&gt; _errors = new Dictionary&lt;string, string&gt;();</p><p></p><p>        partial void OnMeasureTitleChanging(string value)</p><p>        {</p><p>            if (value.Trim().Length == 0)</p><p>                _errors.Add(&quot;MeasureTitle&quot;, &quot;MeasureTitle is required.&quot;);</p><p>        }</p><p></p><p>        #region IDataErrorInfo Members</p><p>        public string Error</p><p>        {</p><p>            get</p><p>            {</p><p>                return string.Empty;</p><p>            }</p><p>        }</p><p></p><p>        public string this[string columnName]</p><p>        {</p><p>            get</p><p>            {</p><p>                if (_errors.ContainsKey(columnName))</p><p>                    return _errors[columnName];</p><p>                return string.Empty;</p><p>            }</p><p>        }</p><p>        #endregion</p><p>    }</p><p>}</p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/NTurnbullJr.jpg?forceidenticon=false&amp;dt=635045143200000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by CharlyLiu</title><link>http://asp.net/mvc/tutorials/older-versions/models-(data)/validating-with-the-idataerrorinfo-interface-cs</link><pubDate>Sun, 03 Apr 2011 02:45:43 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000012690</guid><description><![CDATA[ <p>@@renan.lifestyle, </p><p>i think in the tutorial, Stephen has explained your  concerned issue, please look below content:</p><p> [ The DefaultModelBinder detects whether or not a class implements the IDataErrorInfo interface. If a class implements this interface then the model binder invokes the IDataErrorInfo.this indexer for each property of the class. If the indexer returns an error message then the model binder adds this error message to model state automatically.]</p><p></p><p>before the action called, it will initialize an instance automatically. During the initialization, it will invoke IDataErrorInfo.this indexer to find whether or not has errors iterative. if errors exist, the DefaultModelBinder will add these errors to ModelState. this ModelState will display in the view.</p>]]></description><enclosure length="0" type="image/png" url="http://i2.asp.net/avatar/CharlyLiu.jpg?forceidenticon=false&amp;dt=635045143200000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item></channel></rss>