Debugging client-side ASP.NET validators

I used this JavaScript snippet to debug an ASP.NET page that was swallowing client-side validation errors (in an UpdatePanel *gag*). I would click a button to submit a form, and nothing would happen — no visual indication of which validators were failing — so I opened the Chrome console and quickly iterated through the validators to locate the offender.

for(var i in Page_Validators) {
  var v = Page_Validators[i];
  if(v.isvalid) {

If you want it on one line (easy to paste into Chrome), refer to my github gist.

If you want to read more about ASP.NET client-side validators (I dunno, maybe you have insomnia), check out the official MSDN documentation.

3 thoughts on “Debugging client-side ASP.NET validators

Leave a Reply

Your email address will not be published. Required fields are marked *