Webcontrol containing a UserControl?? Problem ...

Discussion in 'ASP .Net Web Controls' started by CubeFish, Feb 21, 2004.

  1. CubeFish

    CubeFish Guest

    I am building a WebControl component that will implement a complete
    message board system. So far so good and I am listing forums,
    messages etc.

    Now I am trying to embed various UserControls (forms for posting,
    preview etc.) into the main WebControl. I am using the following code
    during render:

    Control objParent = Page.FindControl("objParent");
    string strPath = m_strInstallDir + "/Forms/" + strObject + ".ascx";
    Page.LoadControl(strPath);
    UserControl objForm = (UserControl)Page.LoadControl(strPath);
    this.Controls.Add(objForm);

    This works fine and I am able to render the form into the control by
    using RenderChildren() during rendering. Should I be adding the
    control at some other point during initialization of the web control?

    My problem is that all the OnClick events in the UserControl no longer
    seem to work! The UserControl using codebehind with all the events in
    the .CS file. How can I hook up all the events????

    I also fail to get the any postback in the WebControl's
    RaisePostBackEvent ...

    Can anyone point me to a working sample of what I am trying to do?
    Is it possible .. if so why can't I find any samples!!

    CubeFish
     
    CubeFish, Feb 21, 2004
    #1
    1. Advertisements

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. huobazi
    Replies:
    1
    Views:
    889
    David Waz...
    Jul 3, 2003
  2. Ivan Demkovitch
    Replies:
    1
    Views:
    369
    Ivan Demkovitch
    Oct 7, 2003
  3. Guest
    Replies:
    2
    Views:
    918
  4. ujjc001
    Replies:
    0
    Views:
    759
    ujjc001
    Jul 25, 2007
  5. Rocky Moore

    Problem with WebControl and dynamic UserControl..

    Rocky Moore, Jul 20, 2003, in forum: ASP .Net Building Controls
    Replies:
    3
    Views:
    223
    Rocky Moore
    Jul 22, 2003
  6. et
    Replies:
    0
    Views:
    306
  7. Ivan Demkovitch

    Webcontrol containing other controls issue (please, IMPORTANT!)

    Ivan Demkovitch, Oct 7, 2003, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    166
    Ivan Demkovitch
    Oct 7, 2003
  8. Mark van Bree

    Postback problem with usercontrol in usercontrol

    Mark van Bree, May 30, 2006, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    258
Loading...