creating web user controls

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all
i create a web user control
i need to create one at runtime when i fire some events
any ideas??
thanks
 
Use the "LoadControl" method and add the control to the "Controls"
array of some container e.g.

MyControl myControl1 = (MyControl)LoadControl("UcMyControl.cs.ascx");
PlaceHolder1.Controls.Add(myControl1);

Rgd,
Peter Theill
 
Also be aware that if you load dynamic controls in response to a user driven
event, they wouldnt be recreated on multiple postbacks
 
Back
Top