Dynamically loading User Controls

  • Thread starter Thread starter Christian Resma Helle
  • Start date Start date
C

Christian Resma Helle

Hey guys,

I'm working on an AJAX Enabled ASP.NET Web application. I have a TreeView
web control and an PlaceHolder web control. My PlaceHolder is inside an
UpdatePanel and AsyncPostBacks are triggered by the SelectedNodeChanged
event of the TreeView. I dynamically load user controls into my PlaceHolder
depending on what node the user clicks on the TreeView. The user control is
loaded into the page and is displayed to the user.

These user controls would normally have a buttons for save, update, and
delete operations. My problem is that "SOMETIMES" when I click on a button
in my dynamically loaded user control, the user control is just reloaded and
the button click event is not fired. This problem does not occur every time
though, which makes it very annoying!

Any ideas on how to ensure that buttons within my dynamically loaded user
controls fire click events everytime its clicked?
 
Found the problem! I did not set the ID of the UserControl I wanted to load
dynamically.
 
Back
Top