Programatically Add Control to ASP.NET C# Page on Button Click
<p>I want to be able to add fixtures to a particular gameweek on my asp.net c# page.</p>

<p>When a user clicks the add button, it should create two drop downs so they can select the home and away team. I want to be able to allow as many fixtures as the user wants to add, so therefore I need a dynamic way of adding controls to the page. Once all of the fixtures have been added, I want them all to be saved to the database.</p>

<p>Scrolling trough forums I have found the following method to get a control to be added programatically:</p>

<p>c#</p>

<pre><code>        protected void AddTeamButton_Click(object sender, EventArgs e)
    {
        DropDownList homeTeamName = new DropDownList();
        homeTeamName.Items.Add("Arsenal");
        homeTeamName.Items.Add("Aston Villa");
        homeTeamName.ID = "homeTeam";
        PlaceHolder1.Controls.Add(homeTeamName);

        DropDownList awayTeamName = new DropDownList();
        awayTeamName.Items.Add("Arsenal");
        awayTeamName.Items.Add("Aston Villa");
        awayTeamName.ID = "awayTeam";
        PlaceHolder1.Controls.Add(awayTeamName);
    }
</code></pre>

<p>aspx:</p>

<pre><code>&lt;asp:PlaceHolder ID="PlaceHolder1" runat="server"&gt;&lt;/asp:PlaceHolder&gt;
</code></pre>

<p>This however only creates one set of controls, the second time you click add, nothing happens. It also does not create uniques IDs to access when I need to save. </p>

<p>Any ideas how I can solve these issues I am having?</p>
