Home > Asp.net > Adding UserControl Dynamically and Set Properties in Asp.net

Adding UserControl Dynamically and Set Properties in Asp.net


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

About these ads
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: