Link to home
Start Free TrialLog in
Avatar of Berico
BericoFlag for United States of America

asked on

errorprovider with validationsummary

Webforms has a validationsummary that is connected to the validators. Is there any way to have errorprovider to send its error to a label for example instead of tootip?
Avatar of brutaldev
brutaldev
Flag of South Africa image

You can enumerate the errors by looping though the control collection on your form. Won't be fast on big forms with loads of controls but will work.

Add a label that you want the errors to be displayed on and write something like this:
 
myErrorLabel.Text = string.Empty;

foreach (Control ctrl in myErrorProvider.ContainerControl.Controls)
{
  myErrorLabel.Text += myErrorProvider.GetError(ctrl) + Environment.NewLine;
}

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial