Executing and rendering user controls via LoadControl and RenderControl

D

Deane

I am rendering a user control manually using "LoadControl" and
"RenderControl" to get the results of the control (the HTML) back as a
string. The control is never added to the Page's Controls collection.

This is causing all kinds of problems with child controls of the
control I'm rendering manually. Those child controls may have code in
their Page_Load events (which doesn't fire), and -- additionally --
the RenderControl method doesn't seem to cause child controls to
render themselves.

I need to be able to execute a control in a "sandbox," so to speak. I
need an execution space that will render all child controls, fire all
events, etc. just as if the control was in Page's Controls
collection. But I need to get the resulting HTML back as a string.

How possible is this?
 

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

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top