Help: Control lost doesn't raise event after being moved to dynamically loaded user control

T

Thanh Nguyen

Hi everyone, I'm encountering a very weird problem, I have spent the
last 3 days trying to figure out how to fix but there is still no
clue. Here is the problem:

I define 2 WebUserControls:

- Content.ascx has a TabStrip control and a Button on it.

- Box.ascx has a PlaceHolder control on it.

In the OnInit() event handler, I create a table cell and dynamically
add the Box.ascx control to the table Cell using LoadControl() method.
Then I dynamically add the Content.ascx control to the PlaceHolder
inside the Box.ascx control.

When the webapp runs, clicking on the Button (in Content.ascx) does
raise the event, clicking on the TabStrip control (also in
Content.ascx) does NOT rise the event.

The weird thing is if I don't use LoadControl() but instead creating a
Panel control and add the Content.ascx to the Panel control then it
works fine.

It seems there is something wrong with dynamic control loading & the
PlaceHolder but I'm not sure :(

Could someone please help? Much appreciated!!!

Thanks
 

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

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,190
Latest member
ClayE7480

Latest Threads

Top