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. Advertising

  2. Hello AhmetG

    > 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.

    Thats a standard behavior of ASP.NET.
    Whats the reason for your approach?
    More details please...

    --
    Gruss, Peter Bucher
    Microsoft MVP - Visual Developer ASP / ASP.NET, Switzerland
    http://www.aspnetzone.de/ - ASP.NET Zone, die ASP.NET Community
    http://www.aspnetzone.de/blogs/peterbucher/ - Auf den Spuren von .NET
    Peter Bucher [MVP], May 1, 2008
    #2
    1. Advertising

  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


    "Ahmet Gunes" <> wrote in message
    news:%...
    > 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
    >
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider], May 10, 2008
    #3
    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. Mich
    Replies:
    2
    Views:
    436
  2. Andy

    ASP.NET suppress response HTML

    Andy, May 30, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    4,031
  3. Ahmet Gunes
    Replies:
    1
    Views:
    360
    bruce barker
    Apr 14, 2008
  4. John Wallace

    Suppress User Control Rendering

    John Wallace, Sep 3, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    194
    John Wallace
    Sep 4, 2003
  5. Ahmet Gunes

    How to suppress all Response content from within a control?

    Ahmet Gunes, Apr 14, 2008, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    160
    AhmetG
    Apr 14, 2008
Loading...

Share This Page