Validation errors count
How can I count all the validation errors in page when I submit the button
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Bhushan BhureRank #5,034 · 314 reputationPosted Aug 3, 2012, 1:57 PM EDT
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.
Dinesh Ambaliya45 reputationPosted Aug 4, 2012, 2:47 AM EDT
I putted javascript on button client click event. But is there any other event where I can put this script to count errors.
Bhushan BhureRank #5,034 · 314 reputationPosted Aug 6, 2012, 6:17 AM EDT