Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > How to implement "PostRender" event for Controls

Reply
Thread Tools

How to implement "PostRender" event for Controls

 
 
DC
Guest
Posts: n/a
 
      09-26-2005
Hi,

we need to dynamically load WebControls and WebUserControls and
manipulate the rendered output (before output fragment caching).
Actually, merely some static replacing of strings is required. And yes,
this requirement should not exist but it does.

We cannot overwrite the Render Method since our framework must support
all kinds of controls.

Is there a way to hook in after the Render method? I know this is
possible on a Page level (HttpModule) by manipulating the Response
Stream, but I guess this won't help since these replaces then have to
be exercised on every request no matter if the control uses caching or
not (?).

TIA for any hints!

Regards
DC

 
Reply With Quote
 
 
 
 
Brock Allen
Guest
Posts: n/a
 
      09-26-2005
Look into HttpResponse.Filter. It allows you to put your own Stream through
which the response is sent. Your filter then emits whatever it wants to.

-Brock
DevelopMentor
http://staff.develop.com/ballen

> Hi,
>
> we need to dynamically load WebControls and WebUserControls and
> manipulate the rendered output (before output fragment caching).
> Actually, merely some static replacing of strings is required. And
> yes, this requirement should not exist but it does.
>
> We cannot overwrite the Render Method since our framework must support
> all kinds of controls.
>
> Is there a way to hook in after the Render method? I know this is
> possible on a Page level (HttpModule) by manipulating the Response
> Stream, but I guess this won't help since these replaces then have to
> be exercised on every request no matter if the control uses caching or
> not (?).
>
> TIA for any hints!
>
> Regards
> D



 
Reply With Quote
 
 
 
 
DC
Guest
Posts: n/a
 
      10-11-2005
Thank you for the hint, Brock, and sorry for the late reply.

The problem of this approach is, that it will always intercept uncached
data and therefore imply quiet a performance hit.

However, I implemented an intercepting filter based on this approach
(here is a good article to get started on the topic:
http://www.awprofessional.com/articl...&seqNum=3&rl=1)
and it works... so so.

One problem is, that one should actually manipulate the byte array
passed to the filter directly to get good performance
(Buffer.Blockcopy() and the like).

Another problem is, that the framework sends chunks of data to the
write method of the filter and it looks as if it is using "good" chunks
(i.e. the framework splits on </p> positions and the like) but it may
happen that one wants to replace data right at the edge between two
chunks and then a more complicated overflow method needs to be
implemented.

I am OK with my intercepting filter currently, but wanted to check if
someone know an alternative approach or a tailor made component for
this.

Cheers
DC

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Controls.Count, Controls.IsSynchronized, and Controls.SyncRoot Nathan Sokalski ASP .Net 4 09-05-2007 03:27 AM
how to implement onlick event on a node? Cylix Javascript 3 04-03-2007 11:23 AM
event based model - best way to implement? snacktime Ruby 11 10-13-2005 08:22 AM
How to force the child controls OnClick event before the parent controls CreateChildControls method? Arulraja ASP .Net 3 10-17-2003 04:22 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57