Problem loading states of server controls residing in user control
<p>I have user control which contains two text boxes and two dropdown list. I am loading this control first time on <code>page_load</code> event programatically. After that on each button click event of "Add New" button, controls are added dynamically but when this happens, previously loaded controls are showing all server controls(which are inside user control) empty. How can i retain the state of these controls?
My user control code is as shown below.</p>

<pre><code>&lt;%@ Control Language="C#" AutoEventWireup="true" CodeFile="qualificationControl.ascx.cs" Inherits="qualificationControl" %&gt;
&lt;style type="text/css"&gt;

.RowHeight
{
    height: 30px;
}
&lt;/style&gt;
&lt;table width="100%"&gt;
    &lt;tr&gt;
        &lt;td class="RowHeight" width="20%"&gt;
            Course Name&lt;/td&gt;
        &lt;td width="20%"&gt;
            &lt;asp:DropDownList ID="courseList" runat="server" Width="100px"&gt;
            &lt;/asp:DropDownList&gt;
        &lt;/td&gt;
        &lt;td width="20%"&gt;
            Year of Passing&lt;/td&gt;
        &lt;td width="*"&gt;
            &lt;asp:DropDownList ID="yearList" runat="server" Width="100px"&gt;
                &lt;asp:ListItem Value="0"&gt;2005&lt;/asp:ListItem&gt;
                &lt;asp:ListItem Value="1"&gt;2006&lt;/asp:ListItem&gt;
                &lt;asp:ListItem Value="2"&gt;2007&lt;/asp:ListItem&gt;
                &lt;asp:ListItem Value="3"&gt;2008&lt;/asp:ListItem&gt;
                &lt;asp:ListItem Value="4"&gt;2009&lt;/asp:ListItem&gt;
            &lt;/asp:DropDownList&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td class="RowHeight" width="20%"&gt;
            Percentage&lt;/td&gt;
        &lt;td colspan="3"&gt;
            &lt;asp:TextBox ID="percentageBox" runat="server"&gt;&lt;/asp:TextBox&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
        &lt;td class="RowHeight" width="20%"&gt;
            Instutitute Name&lt;/td&gt;
        &lt;td colspan="3"&gt;
            &lt;asp:TextBox ID="InstiNameBox" runat="server" Width="350px"&gt;&lt;/asp:TextBox&gt;
        &lt;/td&gt;
    &lt;/tr&gt;
&lt;/table&gt;
</code></pre>

<p>and that of aspx.cs page is as below.</p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;

public partial class AppplicationForm2 : System.Web.UI.Page
{
    Control qualificationControl;
    UserControl usrqualificationControl = new UserControl();
    int CtrlID = 0;
    protected void Page_Load(object sender, EventArgs e)
    {
        qualificationControl = usrqualificationControl.LoadControl("~/control/qualificationControl.ascx");
        if (!IsPostBack)
        {
            ArrayList CtrlList = new ArrayList();
            qualificationControl.ID = CtrlID.ToString();
            UserCtrlHolder.Controls.Add(qualificationControl);
            CtrlList.Add(qualificationControl);
            Session.Add("qualiControl", CtrlList);
        }
        //else 
    }
    protected void addQualificationBtn_Click(object sender, EventArgs e)
    {
        ArrayList CtrlList = null;
        ArrayList CourseList = new ArrayList();
        ArrayList YearList = new ArrayList();
        ArrayList percentageList = new ArrayList();
        ArrayList InstituteList = new ArrayList();
        if (Session["qualiControl"] != null)
        {
            CtrlList = (ArrayList)Session["qualicontrol"];
        }
        qualificationControl.ID = CtrlList.Count.ToString();
        CtrlList.Add(qualificationControl);
        for (int i = 0; i &lt; CtrlList.Count; i++)
        {
            UserCtrlHolder.Controls.Add((Control)CtrlList[i]);
        }
    }
    private void RestoreUserControl(ArrayList CourseList,ArrayList YearList,ArrayList PercentageList,ArrayList InstiNameList,ArrayList CtrlList)
    {
        for (int CtrlCnt = 0; CtrlCnt &lt; CtrlList.Count - 1; CtrlCnt++)
        {
            Control userControl = (Control)UserCtrlHolder.FindControl(CtrlID.ToString());
            DropDownList dlCourseList = (DropDownList)userControl.FindControl("courseList");
            DropDownList dlYearList = (DropDownList)userControl.FindControl("yearList");
            TextBox percentageBox = (TextBox)userControl.FindControl("percentageBox");
            TextBox InstiNameBox = (TextBox)userControl.FindControl("InstiNameBox");

            dlCourseList.ClearSelection();
            dlYearList.ClearSelection();
            dlCourseList.Items.FindByText(CourseList[CtrlCnt].ToString()).Selected = true;
            dlYearList.Items.FindByText(CourseList[CtrlCnt].ToString()).Selected = true;
            percentageBox.Text = PercentageList[CtrlCnt].ToString();
            InstiNameBox.Text = PercentageList[CtrlCnt].ToString();
        }
    }

}
</code></pre>
