Last post Oct 21, 2008 05:15 AM by benjib98
Oct 15, 2008 12:43 PM|benjib98|LINK
I am having difficulties with rendering a PlaceHolder in my custom web control. Basically I have a custom web control with a PaceHolder inside it, which I am populating with any other controls -so that the custom control behaves like a box, adding some
layout and functionalities to its content (a dynamically loaded UserControl) which is added to this custom control's PlaceHolder:
//my custom control is drag and dropped onto the page and is called CustomControl1 and has its PlaceHolder exposed as a public control property called DynamicContent
UserControl uc1 = LoadControl("~/Pages/TestPage.ascx") as UserControl;
,but when I render the custom control's PlaceHolder in the Render(writer)
the UserControl content doesn't appear to be in the box. What I am missing here? Can I actually render a UserControl in this way or it is to do with the PlaceHolder?
Oct 20, 2008 11:03 PM|Nai-Dong Jin - MSFT|LINK
From your description, it seems that you want to add a user control into the container in your custom server control, but it doesn’t work, right?
If so, I think you need to add break points into your custom server control app, and try to check if you have get the user control instance successfully, and if
it has been added to your control container collection.
Oct 21, 2008 05:15 AM|benjib98|LINK
I have sorted out this issue, but got another rock by the event wiring inside the dyamic user control. As the custom control's content id loaded dynamically from the user control, I am loosing the events inside this user control. More clearly I have some
buttons in the user control, which should fire a postback event save, cancel etc actions, but nothing happens. I guess as the user control is loaded dynamically the events are not wired properly.
What is the best approach in such circumstances, how can I make sure the button click event will be hit?