validationsummary control

R

rufus

How do I access the error output text of the validationsummary control so
that I can reformat how it is displayed?

Thanks
 
S

Scott Mitchell [MVP]

rufus said:
How do I access the error output text of the validationsummary control so
that I can reformat how it is displayed?

Rufus, there is no property of the Validation Control that you can grab
to get the markup it uses. The only way you can control the output is
through setting the ErrorMessage properties of the validation controls
on the page, and by fiddling with the ValidationSummary's DisplayMode
property.

You could, of course, create your own validation summary control that
extends the existing ValidationSummary control, and override the
Render() method and emit your custom markup. This would be the way to
go, ideally. A perhaps quicker hack would be to just use Reflector
[http://www.aisto.com/roeder/dotnet/] and cut and paste the
ValidationSummary control's code from its Render() method into your
page, and modify it as needed. Essentially the ValidationSummary
control loops through the Page.Validators collection, grabs the
ErrorMessage of each non-valid validator, and then displays it in a
format specified via the DisplayMode property.

Happy Programming!

--

Scott Mitchell
(e-mail address removed)
http://www.4GuysFromRolla.com

* When you think ASP.NET, think 4GuysFromRolla.com!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top