Webcontrol containing a UserControl?? Problem ...

C

CubeFish

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
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top