How to add User Control at run time

  • Thread starter Thread starter Yuriy
  • Start date Start date
Y

Yuriy

Hello, friends! I created a user control which display
header on my page and simply add this control in design
time, but i have a form which generated dynamically using
statements Response.Write("...."). My question is how to
add user control at run time.
Thank you for advice.
 
Hi,

This should do:
Control c = Page.LoadControl("yourusercontrol.ascx");

parent.Controls.Add(c);
 
Back
Top