Faqs on asp.net,c#,vb.net and sqlserver2005

this blog covers all the Faqs related to .net technologies like asp.net,vb.net,c#.net,ajax,javascript and sqlserver2005.

Mar 11, 2008

adding user controls dynamically in asp.net

How to add user control dynamically to a asp.net webpage?

protected void addUserControl()
{
Control c = LoadControl("UserControl1.ascx");
c.ID = "uc";
this.Panel1.Controls.Add(c);
}
protected void Button1_Click(object sender, EventArgs e)
{
addUserControl();
}

References:

http://aspalliance.com/565_Dynamic_Loading_of_ASPNET_User_Controls
http://www.singingeels.com/Articles/Dynamically_Created_Controls_in_ASPNET.aspx

Happy Programming

0 Comments:

Post a Comment

<< Home