Wednesday, May 17, 2006

Suggestion: Add Reqired to all ASP.Net validators

ASP.Net has a very nice feature called validators - you assign a validtor to a control and you specify what has the control must contain before the page is posted back and or vaildated at the server.

Nice... The only problem is that (as I see it) there are 2 kinds of validators the RequiredFieldValidator and the rest of them

Requiredfiledvaildator makes sure that the field is filled in in general - while the others make sure that what was filled in follows a specified format - So I have a form with a bunch of fill in boxes , now I have to add 2 validators to each item , a reqed and a data format.

While I can underatand that there are times that the data does not have to be there but if it does it needs to be valid - many other times (if not most) both are needed.

So my suggestion - Add a property to all validators (via BaseValidator) called ??IsRequired?? - so that one validator can do everything needed.

This page is powered by Blogger. Isn't yours?