2 CustomValidators in a Page ?

  • Thread starter Thread starter Tiësto
  • Start date Start date
T

Tiësto

Does it represent an error? I couldn't get to work 2 of them, I and thought
maybe it isn't possible, and the two server validation functions must be put
together.
 
Hi ,

Thanks for posting. As for the put multi custom valicator s on asp.net page
you mentioned, is the custom validtor you use have both clientside
validation and serverside validtion? If it has clientside valiation, maybe
sometimes when one validator capture errors, it will prevent the other
validtor from contintue to validate. I think you can try disable the
clientside valition and only use serverside valition to see whether both of
the 2 custom validators work. Generally at serverside, the page will loop
through all the validators (enabled) on tha page and call their validate
functions. Here is a tech article on this:

#ASP.NET Validation in Depth
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html
/aspplusvalid.asp

Hope helps.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Thanks again Steven.

Both controls had their EnableClientScript property set to false, and when I
was debugging, I was debugging on the server. But I put a breakpoint on the
second "ServerValidate" method and it was never consulted to see if the page
was valid. A call to SecondControl.Validate was necessary for de event
handler to be proccesed.

When I had already put both validations on a single ServerValidate event
handler, (but leaving aline with a breakpoint on the second) this second EH
started to work. This kind of things happen, don't worry. Thanks a lot.
 
Thanks for your followup.

Anyway, glad that you've found the cause of the problem.
Also, if there're anything else we can help later, please feel free to
post. Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Back
Top