locked
Trying to Use Adapter To Modify ValidationSummary to use Span instead of Div RRS feed

  • Question

  • User846759423 posted
    Not sure this is the right forum for this, but I am trying to write a WebControlAdapter to simply have a ValidationSummary control render a Span tag instead of a Div tag as it's outer-most tag.  Inside my adapter I have:

            protected override void RenderBeginTag(HtmlTextWriter writer)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.Span);
            }

            protected override void RenderEndTag(HtmlTextWriter writer)
            {
                writer.RenderEndTag();
            }

    The problem is, none of the rest of the control renders at all, and it stops working entirely.  I just get the <span></span>

    Shouldn't the objects Render() be called if I don't override it?  What am I missing?  How can I do this?

    P.S.  The root problem I am trying to solve is the problem that when using a validation summary control inside an update panel with an ajax form, the page scrolls to the top when there are validation errors.  Based on I believe we can correct this with the right tweaks to the output html/javascript?
    Wednesday, July 12, 2006 7:24 PM

All replies

  • User-626038317 posted

    If you are overriding, you should call the base method before apply modification.

     something like :

    protected override void RenderBeginTag(HtmlTextWriter writer)
            {

                base.RenderBeginTag();
                writer.RenderBeginTag(HtmlTextWriterTag.Span);
            }

     

    hope this help.

    Wednesday, January 16, 2008 11:42 AM