Executing and rendering user controls via LoadControl and RenderControl

Discussion in 'ASP .Net Building Controls' started by Deane, Sep 3, 2007.

  1. Deane

    Deane Guest

    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?
    Deane, Sep 3, 2007
    1. Advertisements

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