Property IsValid() method?

Topics: Developer Forum
Jul 16, 2007 at 5:24 PM
I've been using the EViL library for awhile now and I love how much it has simplified adding and maintaining validation rules in my projects. One question that has come up is how can I check to see if one particular property in my class is valid?

This comes into play because in addition to displaying a summary of errors at the top of the page, I'd like to be able to put markers next to each field that is invalid.

So the form would be like:

  • First name is required

First Name TextBox *

Last Name TextBox

Is there a way to accomplish this with the existing code base, or am I using the wrong tool for this sort of functionality?

Thanks.

Feb 19, 2008 at 6:43 PM
This would be useful. It would allow more fine scale identification and notification of errors to the application user.
Apr 23, 2008 at 12:17 AM

meh wrote:
I've been using the EViL library for awhile now and I love how much it has simplified adding and maintaining validation rules in my projects. One question that has come up is how can I check to see if one particular property in my class is valid?

This comes into play because in addition to displaying a summary of errors at the top of the page, I'd like to be able to put markers next to each field that is invalid.

So the form would be like:

  • First name is required

First Name TextBox *

Last Name TextBox

Is there a way to accomplish this with the existing code base, or am I using the wrong tool for this sort of functionality?

Thanks.



See my recent post http://www.codeplex.com/evil/Thread/View.aspx?ThreadId=26424 (sorry-I didn't see this post until after I posted mine) on how I have extended the error message to contain more information so that I can iterate through the collection and identify to which property each error belongs.