Archive

Posts Tagged ‘codebehind’

Adding UserControl Dynamically and Set Properties in Asp.net

November 8, 2010 1 comment

Adding UserControl Dynamically and Set Properties in Asp.net

ucMyUserControl ucUser = (ucMyUserControl )LoadControl(“~/folder/MyUserControl.ascx”);
ucUser.MyProperty = “I got my property”; 
MyDiv.Controls.Add(ucUser);

For More Details Visit : http://www.highonmicrosoft.com/dynamically-loading-and-accessing-the-properties-of-the-user-control.html http://stackoverflow.com/questions/213429/programmatically-adding-user-controls-inside-an-updatepanel http://geekswithblogs.net/samerpaul/archive/2009/11/13/dynamically-adding-web-user-controls-and-accessing-their-properties-by.aspx http://stackoverflow.com/questions/508826/set-properties-on-dynamically-added-usercontrol

Advertisements