Author: spinz2112 | Posted on: 9/27/2008 1:05:55 AM | Views : 600

I am trying to figure out how to add user controls one under the other dynamically on, say a button click. That is, for each press of my "Add" button, i want to create a user control under the previous one. I know how to add a single user control, but when I try to add multiples, it just displays it on the same spot as the existing one, thereby overwriting it and not stacking it. here is my code to add a user control:

  protected void btnAddControl_Click(object sender, EventArgs e)
{
ViewState["count"] = int.Parse(ViewState["count"].ToString()) + 1;

ASP.MyUserControl myControl = new ASP.MyUserControl();
myControl.textToDisplay = ViewState["count"].ToString();
placeHolder.Contro ...

Go to the complete details ...