How to suppress Response from within a control?

A

Ahmet Gunes

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
 
P

Peter Bucher [MVP]

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

Steve C. Orr [MCSD, MVP, CSM, ASP Insider]

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
 

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

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top