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
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. charles

    RenderControl and Web User Controls

    charles, Oct 9, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    441
    charles
    Oct 9, 2004
  2. Replies:
    0
    Views:
    1,115
  3. Josh Carver

    Some controls cannot RenderControl

    Josh Carver, Jul 9, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    508
    Josh Carver
    Jul 10, 2007
  4. Nigil

    RenderControl with Sub Controls.

    Nigil, Jan 14, 2008, in forum: ASP .Net
    Replies:
    2
    Views:
    375
    bruce barker
    Jan 14, 2008
  5. J055

    User controls and LoadControl method

    J055, Oct 3, 2006, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    148
    Luke Zhang [MSFT]
    Oct 5, 2006
Loading...

Share This Page