Validation errors count
How can I count all the validation errors in page when I submit the button
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Bhushan BhurePosted Aug 3, 2012, 5:57 PM
I dont think that you can get that directly as like some control's error count..
But you can do one thing, if you just need the count.
Put ValidationSummary control on a page.
If there are any errors on Page then Validationsummary control will display all errors as a list.
So in javascript function, get the innerHtml of the validationSummary and get the count of
var obj = document.getElementById("ValidationSummary1");
var errorCount = obj.innerHTML.split("
alert('Page is not valid! ' + errorCount + ' Errors');
Thanks,
Please mark this answer as accepted answer if it resolves your problem.
Bhushan BhurePosted Aug 6, 2012, 10:17 AM
Dinesh AmbaliyaPosted Aug 4, 2012, 6:47 AM
I putted javascript on button client click event. But is there any other event where I can put this script to count errors.