How to suppress Response from within a control?

Discussion in 'ASP .Net Building Controls' started by Ahmet Gunes, Apr 14, 2008.

  1. Ahmet Gunes

    Ahmet Gunes Guest

    Hello,

    I am developing a custom control.
    From within this control, maybe during/before rendering, I want to totally
    clear the response content and only render this control's output.
    When I use Response.Clear() and/or Response.ClearContent() and/or delete
    controls from the Controls collection of the Page I still get the closing
    tags of form, body, and html tags in the resulting html.

    Any idea?

    Thanks in advance,

    AhmetG
     
    Ahmet Gunes, Apr 14, 2008
    #1
    1. Advertisements

  2. Hello AhmetG
    Thats a standard behavior of ASP.NET.
    Whats the reason for your approach?
    More details please...
     
    Peter Bucher [MVP], May 1, 2008
    #2
    1. Advertisements

  3. It sounds like you are clearing all of the page processing that happened
    before the control is rendered, but not after.
    You should be able to solve this problem by making your last line of code
    this:
    Response.End()

    --
    I hope this helps,
    Steve C. Orr,
    MCSD, MVP, CSM, ASPInsider
    http://SteveOrr.net
    http://iPhonePlaza.net
     
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider], May 10, 2008
    #3
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.