How to suppress all Response content from within a control?

Discussion in 'ASP .Net Web 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. Ahmet Gunes

    AhmetG Guest

    Thanks for your reply Patrice...

    What I am trying to do is to develop a custom control similar to
    LiveControls at www.dart.com.
    The most important feature of those controls is being able to use ViewState
    and raise server-side events (e.g. OnTextchanged) on ajax calls.
    Whatever controls you have in your ASPX file the response is always
    javascript code and when you debug you see that an ajax request is
    interpreted as a postback, although not everything is posted back.
    For that reason, all control related events (of LiveControls) are also being
    raised and the response only contains the javascript generated by those
    custom controls (e.g. LiveControls).
    If I can achieve this it will be very great for me...

    Thanks



    "Patrice" <http://www.chez.com/scribe/> wrote in message
    news:%...
    > You could use Response.End to stop further processing ? If you don' need
    > any form of markup you could remove those tags from the ASPX page...
    >
    > You may want to elaborate a bit on what you are trying to do as this is
    > quite unusual to have a control suppress all other output and stop all
    > processing. For example, if not already done, you could perhaps consider
    > using a http handler ?
    >
    > --
    > Patrice
    >
    > "Ahmet Gunes" <> a écrit dans le message de 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
    >>

    >
    >
    AhmetG, Apr 14, 2008
    #2
    1. Advertising

  3. Ahmet Gunes

    AhmetG Guest

    Patrice, you are right... UpdatePanel also does (almost) the same thing.
    Maybe I was always thinking in a different way.
    I'll try to find UpdatePanel's source code...

    By the way, according to my observations, UpdatePanel also sends the
    ViewState with each Ajax request.
    On the other hand, Livecontrols do not send Viewstate. I think they store
    viewstate either in Cache or session, which is better of course.

    Thanks for your help...

    AhmetG


    "Patrice" <http://www.chez.com/scribe/> wrote in message
    news:%...
    > It looks quite a standard behavior for an AJAX control. I'm not familiar
    > with this but have you tried an AJAX control creation tutorial ? I would
    > be *very* surprised if this is something that is not taken care already in
    > the ASP.NET AJAX infrastructure...
    >
    > Having a look at the UpdatePanel control source code would be likely my
    > first step...
    >
    > --
    > Patrice
    >
    >
    > "AhmetG" <> a écrit dans le message de news:
    > uDIhv%...
    >> Thanks for your reply Patrice...
    >>
    >> What I am trying to do is to develop a custom control similar to
    >> LiveControls at www.dart.com.
    >> The most important feature of those controls is being able to use
    >> ViewState and raise server-side events (e.g. OnTextchanged) on ajax
    >> calls.
    >> Whatever controls you have in your ASPX file the response is always
    >> javascript code and when you debug you see that an ajax request is
    >> interpreted as a postback, although not everything is posted back.
    >> For that reason, all control related events (of LiveControls) are also
    >> being raised and the response only contains the javascript generated by
    >> those custom controls (e.g. LiveControls).
    >> If I can achieve this it will be very great for me...
    >>
    >> Thanks
    >>
    >>
    >>
    >> "Patrice" <http://www.chez.com/scribe/> wrote in message
    >> news:%...
    >>> You could use Response.End to stop further processing ? If you don' need
    >>> any form of markup you could remove those tags from the ASPX page...
    >>>
    >>> You may want to elaborate a bit on what you are trying to do as this is
    >>> quite unusual to have a control suppress all other output and stop all
    >>> processing. For example, if not already done, you could perhaps consider
    >>> using a http handler ?
    >>>
    >>> --
    >>> Patrice
    >>>
    >>> "Ahmet Gunes" <> a écrit dans le message de 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
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
    AhmetG, Apr 14, 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:
    438
  2. Andy

    ASP.NET suppress response HTML

    Andy, May 30, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    4,035
  3. Ahmet Gunes
    Replies:
    1
    Views:
    363
    bruce barker
    Apr 14, 2008
  4. Ahmet Gunes

    How to suppress Response from within a control?

    Ahmet Gunes, Apr 14, 2008, in forum: ASP .Net Building Controls
    Replies:
    2
    Views:
    746
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
    May 10, 2008
  5. xingye
    Replies:
    9
    Views:
    262
    Michael Lu
    Apr 19, 2004
Loading...

Share This Page