How to suppress/clear Response from within a control?

Discussion in 'ASP .Net' 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.
    Since the Render event of the page is protected I can not attach an event
    handler at runtime.
    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.

    I wonder if that's possible..

    P.S. A similar message was also posted on aspnet.buildingcontrols and
    aspnet.webcontrols lists.

    Thanks in advance,

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

  2. Ahmet Gunes

    bruce barker Guest

    protected override void Render(HtmlTextWriter writer)
    {
    Response.ClearContent();
    // output my content

    Response.End();
    }


    -- bruce (sqlwork.com)


    "Ahmet Gunes" wrote:

    > 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.
    > Since the Render event of the page is protected I can not attach an event
    > handler at runtime.
    > 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.
    >
    > I wonder if that's possible..
    >
    > P.S. A similar message was also posted on aspnet.buildingcontrols and
    > aspnet.webcontrols lists.
    >
    > Thanks in advance,
    >
    > AhmetG
    >
    >
    >
    >
     
    bruce barker, Apr 14, 2008
    #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. Andy

    ASP.NET suppress response HTML

    Andy, May 30, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    4,091
  2. David

    Response.Clear() doesn't clear

    David, Jan 31, 2008, in forum: ASP .Net
    Replies:
    2
    Views:
    1,049
    Mark Fitzpatrick
    Jan 31, 2008
  3. Ahmet Gunes

    How to suppress Response from within a control?

    Ahmet Gunes, Apr 14, 2008, in forum: ASP .Net Building Controls
    Replies:
    2
    Views:
    766
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
    May 10, 2008
  4. 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:
    175
    AhmetG
    Apr 14, 2008
  5. Replies:
    1
    Views:
    185
    Evertjan.
    Nov 4, 2006
Loading...

Share This Page