Hi Jay,
You can use LoadControl to load a control and then add it to another control, like a Panel or a PlaceHolder. Here's a quick example:
for (int i = 0; i < (numberOfUserInfoControls); i++)
{
UserInfo userInfo = (UserInfo)LoadControl("~/Controls/UserInfo.ascx");
userInfo.ID = "UserInfo" + i.ToString();
myPlaceHolder.Controls.Add(userInfo);
}
In this example, UserInfo is the User Control that is added to a PlaceHolder called myPlaceHolder.
You may need a Control reference in the markup to access properties of your control:
<%@ Register src="Controls/UserInfo.ascx" tagname="UserInfo" tagprefix="uc1" %>
Hope this helps,
Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of
ASP.NET 2.0 Instant Results and
Beginning Dreamweaver MX / MX 2004