Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Irritating issue with Dynamically loaded controls

Status
Not open for further replies.

Kalisto

Programmer
Feb 18, 2003
997
GB
c# / .Net 3.5

I have a page with a number of user controls on it. I have an issue with one that is programmatically generated.

The Control is created on the Master Pages OnInit() event.

When it is created it creates a number of LinkButtons. Clicking on one of these linkbuttons causes a postback to the master page, and the usercontrol itsself is redrawn. However, the event tied to the link button does not fire.

The user controls that are placed on the page in design time also have an equivalent method and way of generating link buttons, but those buttons trigger fine.

Im getting close to just creating a new template for each of the pages that uses a type of the dynamic control, and placing the control on it in design time just to make this issue go away, but that defeats the point of the exercise, so can anyone help me pin this down and fix it?
 
When working with dynamically generated controls, you are responsible for recreating the controls in each post-back, this includes wiring up your events. Make sure you are re-subscribing to the event on each post-back.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top