validationsummary control

Discussion in 'ASP .Net Web Controls' started by rufus, Nov 12, 2004.

  1. rufus

    rufus Guest

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

    Thanks
    rufus, Nov 12, 2004
    #1
    1. Advertising

  2. rufus wrote:
    > 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

    http://www.4GuysFromRolla.com

    * When you think ASP.NET, think 4GuysFromRolla.com!
    Scott Mitchell [MVP], Nov 13, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eitan
    Replies:
    0
    Views:
    460
    Eitan
    Dec 16, 2003
  2. =?Utf-8?B?U3VuaWwgU2FiaXI=?=

    ValidationSummary Control

    =?Utf-8?B?U3VuaWwgU2FiaXI=?=, Jun 16, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    450
    =?Utf-8?B?U3VuaWwgU2FiaXI=?=
    Jun 16, 2004
  3. NuB

    validationSummary control

    NuB, Dec 12, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    375
  4. =?Utf-8?B?YzY3NjIyOA==?=
    Replies:
    2
    Views:
    6,517
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    Jan 13, 2006
  5. Sam
    Replies:
    2
    Views:
    381
Loading...

Share This Page