This project is read-only.

Server side custom validation

Jun 7, 2013 at 11:34 AM
Hi,

Is there any way to render the server side custom errors to web form using this library?
Or any other suggestion will be appreciated.
As I am using this library I was looking if I can use IValidationObject to render server side error message.

Thanks,
Rohan
Jun 8, 2013 at 9:33 AM
Hi,

Currently I see no way to use IValidationObject with this library.
It was designed with following ideas in mind:
  1. Complement and paritally replace standard validation controls (there are no replacement for CompareValidator) where simple input validation scenarios were requiring a lot of code in markup.
  2. Allow developers reuse simple Models in MVC-WebForms hybrid applications. But again, only in simple scenarios. Things like System.Web.Mvc.RemoteAttribute are IValidatableObject are not supported out of box.
IValidatableObject is a good thing but only when you have Model Binding. You can use CustomValidator control with Model Binding if you are building your application against ASP.NET 4.5. Inside ServerValidate event handler of CustomValidator you can restore Model object, validate as IValidatable and add messages back to CustomValidator. I think this should work.