User1853245500 posted
I have created a Visual Web Part for SharePoint 2010 called vwpResultsPlan. I override the OnInit function of the vwpResultsPlanUserControl and dynamically add a UserControl (created within my SharePoint project) called ucPlanDetails to some TabPanels
of a TabContainer. Up to this point this all works fine and the control gets added where it should be. The problem is that there is a save button in ucPlanDetails that when clicked does not fire the button clicked event.
Since the control is added dynamically I'm not sure how to handle the button click event from ucPlanDetails in the parent Visual Web Part vwpResultsPlan. When the button is cliked now, vwpResultsPlan posts back and reloads maintaining any data entered
in ucPlandetails (which is good). I just can't figure out how to capture the button click event on ucPlanDetails.
I figure you have to add an event to the User Control, then call that event on the button click, then handle that event in the Visual Web Part, but with the control loaded dynamically I can't see how to create an event handler for my custom event in the
Visual Web Part code.
Any input would be greatly appreciated. I can provide code if need be.
Thanks,
Justin