Catching ChildControl render output and modify before sent out

R

Ron Vecchi

I have a custom control which has a child control (PlaceHolder)
The placeholder will have any number of child controls added to it.

I would like to catch the rendered content of the placeholder child control
prior to it being sent to the browser and wrap all the HTML content in
document.write('') JS statements.

I'm kind of lost on how to capture the raw HTML content. (for starters :)

Any suggestions
 
J

Jacob Yang [MSFT]

Hi Ron,

Thank you for posting to the MSDN Managed newsgroups. We are acknowledging
your post and you should receive response from the community within 2
business days of your post.

If you have any concerns, please feel free to let us know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
J

Jacob Yang [MSFT]

Hi Ron,

Based on my research and experience, one way I can suggest is that you can
author your own customer control and then override the CreateChildControls
method

For more information, please check the following url.

Authoring Custom Controls
http://samples.gotdotnet.com/quickstart/aspplus/doc/webctrlauthoring.aspx

Does it answer your question? If I have misunderstood your concern, please
feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
R

Ron Vecchi

Actually I am within a custom control.

The control (FlashControl) will give a way to change many of the parameters
and variables to the html markup to embed the flash movie in a webpage.

One of the properties of the control is called NoFlashContent and is a
System.Web.UI.WebControl.PlaceHolder.
In the html markup of the control I output the javascript to check for the
FlashPlugin. In the JS there is an else{} statement that is called when the
FlashPlugin is not on the browser.
This is where the NoFlashContent PlaceHolder comes into play.

I would like to be able to drop controls into the placeholder (n^ deep) and
when all the controls are rendered in the PlaceHolder their HTML output will
be caught and wrapped into document.write() statements.... I was thinking
that I could just place the PlaceHolderControl between to LiteralControls
like:

LiteralControl--- document.write('
PlaceHolder
LiteralControl--- ');

But I will still need to have the raw html so I can escape(JavaScript) any
of the ' characters that might be in the rendered in the PlaceHolder Child
Controls.
I am creating the child controls in the overriden CreatChildControls memthod
but this doesn't give me the already rendered HTML of the child controls?


Thanks for you time,
Ron Vecchi
 
J

Jacob Yang [MSFT]

Hi Ron,

If I didn't misunderstand you, you want to capture the HTML contents before
they are being rendered to client.

I think the WebControl.AddAttributesToRender Method should give you the
chance to interrupt the HTML contents. Please check the following URLs for
the detailed information.

Rendering an ASP.NET Server Control
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconrenderingwebformscontrol.asp

WebControl.AddAttributesToRender Method
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfSystemWebUIWebControlsWebControlClassAddAttributesToRenderTopic.asp.

Does it answer your question? If I have misunderstood your concern, please
feel free to let me know.

Best regards,

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top