title: ASP.NET loses data from form after postback - repeater inside updatepanel inside repeater
body: <p>I have a ASP.NET web form where I have few checkboxes etc to make SearchCriteria object. When I click submit button I ask repeater1 to shew some records according to SearchCriteria. Inside repeater1 I have user control with updatepanel and another one repeater (ChildRepeater). </p>
  
  <p>My problem: when I click send on the button after postback I lose all the data from form (eg that checkboxes was checked). Page is loading default values, but in my code I load default (all checkboxes checked) only if(!IsPostBack).
  Of course I have "EnableViewState=true" in .aspx, I also tried to save data from form in session, but it also does not work (default values rewrite this settings). </p>
  
  <p>When I have only one repeater (repeater1) my form after postback had all the data I put on it, so I think that there is some problem in updatepanel, but I don't know where exactly. 
  Could you explain me why my form loses data after page reload? I can't see any mistake.. </p>
  
  <p>At the bottom are my files but I have n-tier architecture so... i put only necessary files from View/BLL (DAL and sql connection works fine)
  Here you have a screen how it looks: <a href="http://imageshack.com/i/1a0ol5j" rel="nofollow">screen</a></p>
  
  <p>ShowAgreements.aspx (it contains controls and parent repeater):</p>
  
  <pre><code>    &lt;asp:ScriptManager ID="ScriptManager1" runat="server"&gt;&lt;/asp:ScriptManager&gt;
  
      &lt;asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="Repeater1_ItemDataBound"&gt;
          &lt;HeaderTemplate&gt;
              &lt;table style="border: 1px solid #0000FF; width: 1250px"&gt;
                  &lt;tr style="background-color: #3d6db0; color: #000000; font-weight: bold;"&gt;
  
                      &lt;td style="width: 150px;"&gt;Numer&lt;/td&gt;
                      &lt;td style="width: 150px;"&gt;Przedmiot umowy&lt;/td&gt;
                      &lt;td style="width: 150px;"&gt;Odbiorca&lt;/td&gt;
                      &lt;td style="width: 150px;"&gt;Dostawca&lt;/td&gt;
                      &lt;td style="width: 150px;"&gt;Rodzaj umowy&lt;/td&gt;
                      &lt;td style="width: 150px;"&gt;Charakter umowy&lt;/td&gt;
                      &lt;td style="width: 150px;"&gt;Status wypożyczenia&lt;/td&gt;
                      &lt;td style="width: 150px;"&gt;Data podpisania&lt;/td&gt;
                      &lt;td style="width: 150px;"&gt;Status&lt;/td&gt;
                  &lt;/tr&gt;
          &lt;/HeaderTemplate&gt;
  
        &lt;itemtemplate&gt;
          &lt;uc1:FilesRepeaterControl runat="server" id="FilesRepeaterControl" /&gt;
            &lt;/itemtemplate&gt;
          &lt;FooterTemplate&gt;         
              &lt;/table&gt;
          &lt;/FooterTemplate&gt;
      &lt;/asp:Repeater&gt;
  </code></pre>
  
  <p>ShowAgreements.aspx.cs:</p>
  
  <pre><code>AgreementsSearchCriteria AgreementSearchCriteriaObj = new AgreementsSearchCriteria();
  
      protected void Page_Load(object sender, EventArgs e)
      {
          if (!Page.IsPostBack)
          {
              Controller.ReadDostawcy();
              Controller.ReadOdbiorcy();
              Controller.ReadPracownikOdp();
          }
  
          Controller.ReadAllAgreements();
      }
  protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
      {
          if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
          {
               Agreement umowa = e.Item.DataItem as Agreement;
               BazaUmow.Controls.FilesRepeaterControl test = e.Item.FindControl("FilesRepeaterControl") as FilesRepeaterControl;
               test.umowa = umowa;
          }
  
      }
  
  
  protected void szukaj_Click(object sender, EventArgs e)
      {
          if (IsValid == true)
          {
              AddNaviPoint();
              Controller.ReadAllAgreements();
          }
  
      }
  public AgreementSearchCollection BindUmowyResults
      {
          set 
          {
              Repeater1.DataSource = value;
              Repeater1.DataBind();
          }
      }
  </code></pre>
  
  <p>FilesRepeaterControl.ascx
      &lt;%@ Control Language="C#" AutoEventWireup="true" CodeBehind="FilesRepeaterControl.ascx.cs" Inherits="BazaUmow.Controls.FilesRepeaterControl"  %></p>
  
  <pre><code>            &lt;tr&gt;
                  &lt;td style="width: 150px"&gt;
                      &lt;asp:Button ID="btnRozwin" runat="server" Text="+" OnClick="btnRozwin_Click" /&gt;
                      &lt;asp:LinkButton ID="lbl_numerUmowy" runat="server" OnClick="lbl_numerUmowy_Click"&gt;&lt;/asp:LinkButton&gt;
                  &lt;/td&gt;
  
                  &lt;td style="width: 150px"&gt;
                      &lt;asp:Label ID="lbl_przedmiotUmowy" runat="server" /&gt;&lt;/td&gt;
                  &lt;td style="width: 150px"&gt;
                      &lt;asp:Label ID="lbl_odbiorca" runat="server" /&gt;&lt;/td&gt;
                  &lt;td style="width: 150px"&gt;
                      &lt;asp:Label ID="lbl_dostawca" runat="server" /&gt;&lt;/td&gt;
                  &lt;td style="width: 150px"&gt;
                      &lt;asp:Label ID="lbl_rodzajUmowy" runat="server" /&gt;&lt;/td&gt;
                  &lt;td style="width: 150px"&gt;
                      &lt;asp:Label ID="lbl_charakterUmowy" runat="server" /&gt;&lt;/td&gt;
                  &lt;td style="width: 150px"&gt;
                      &lt;asp:Label ID="lbl_statusWypozyczenia" runat="server" /&gt;&lt;/td&gt;
                  &lt;td style="width: 150px"&gt;
                      &lt;asp:Label ID="lbl_dataPodpisania" runat="server" /&gt;&lt;/td&gt;
                  &lt;td style="width: 150px"&gt;
                      &lt;asp:Label ID="lbl_statusUmowy" runat="server" /&gt;&lt;/td&gt;
  
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt;
                      &lt;asp:UpdatePanel ID="UpdatePanelFilesInfo" runat="server"&gt;
                          &lt;ContentTemplate&gt;
                  &lt;asp:Repeater ID="filesRptr" runat="server" OnItemDataBound="filesRptr_ItemDataBound"&gt;
                  &lt;HeaderTemplate&gt;
                      &lt;table style=" width:170px"&gt;
                          &lt;tr style="font-weight: bold;"&gt;
                              &lt;td style="width:170px;"&gt;Pliki umowy&lt;/td&gt;
  
                          &lt;/tr&gt;
                  &lt;/HeaderTemplate&gt;
                  &lt;ItemTemplate&gt;
                      &lt;tr&gt;
                         &lt;td&gt;
                              &lt;asp:LinkButton ID="lblPlikUmowy" runat="server" OnCommand="lblPlikUmowy_Command"&gt;&lt;/asp:LinkButton&gt;&lt;/td&gt;
  
                      &lt;/tr&gt;
  
                  &lt;/ItemTemplate&gt;
                  &lt;FooterTemplate&gt;
                      &lt;/table&gt;
  
                  &lt;/FooterTemplate&gt;
              &lt;/asp:Repeater&gt;
  
  
                  &lt;asp:Repeater ID="aneksyRptr" runat="server" OnItemDataBound="aneksyRptr_ItemDataBound"&gt;
  
                      &lt;HeaderTemplate&gt;
                      &lt;table style=" width:170px"&gt;
                          &lt;tr style="font-weight: bold;"&gt;
                              &lt;td style="width:170px;"&gt;Aneksy do umowy&lt;/td&gt;
  
                          &lt;/tr&gt;
                  &lt;/HeaderTemplate&gt;
                  &lt;ItemTemplate&gt;
                      &lt;tr&gt;
                         &lt;td&gt;
                              &lt;asp:LinkButton ID="lblAneksUmowy" runat="server" OnCommand="lblAneksUmowy_Command"&gt;&lt;/asp:LinkButton&gt;&lt;/td&gt;
  
                      &lt;/tr&gt;
  
                  &lt;/ItemTemplate&gt;
                  &lt;FooterTemplate&gt;
                      &lt;/table&gt;
  
                  &lt;/FooterTemplate&gt;
              &lt;/asp:Repeater&gt;
              &lt;/ContentTemplate&gt;
  
                      &lt;/asp:UpdatePanel&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
  </code></pre>
  
  <p>FilesRepeaterControl.ascx.cs (here we add data to parent repeater and fill two child repeaters when we click button btnRozwin)
      public Agreement umowa { get; set; }</p>
  
  <pre><code>    protected void Page_Load(object sender, EventArgs e)
      {
                  lbl_numerUmowy.Text = umowa.numer_umowy.ToString();
                  lbl_przedmiotUmowy.Text = umowa.przedmiot_umowy.ToString();
                  lbl_odbiorca.Text = umowa.odbiorca_tekst.ToString();
                  lbl_dostawca.Text = umowa.dostawca_tekst.ToString();
                  lbl_rodzajUmowy.Text = umowa.rodzaj_umowy_tekst.ToString();
                  lbl_charakterUmowy.Text = umowa.charakter_umowy_tekst.ToString();
                  lbl_statusWypozyczenia.Text = umowa.status_wypozyczenia_tekst.ToString();
                  lbl_dataPodpisania.Text = umowa.data_podpisania.ToString("yyyy-MM-dd");
                  lbl_statusUmowy.Text = umowa.status_umowy.ToString();
      }
  
      protected void filesRptr_ItemDataBound(object sender, RepeaterItemEventArgs e)
      {
  
          if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
          {
              Plik plik = e.Item.DataItem as Plik;
  
              LinkButton lblPlikUmowy = e.Item.FindControl("lblPlikUmowy") as LinkButton;
              lblPlikUmowy.Text = plik.nazwa_pliku.ToString();
              lblPlikUmowy.CommandArgument = plik.guid + plik.rozszerzenie;
  
          }
  
      }
  
  
      protected void aneksyRptr_ItemDataBound(object sender, RepeaterItemEventArgs e)
      {
          if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
          {
              Plik plik = e.Item.DataItem as Plik;
  
              LinkButton lblAneksUmowy = e.Item.FindControl("lblAneksUmowy") as LinkButton;
              lblAneksUmowy.Text = plik.nazwa_pliku.ToString();
              lblAneksUmowy.CommandArgument = plik.guid + plik.rozszerzenie;
  
          }
  
      }
  
      protected void btnRozwin_Click(object sender, EventArgs e)
      {
          if (btnRozwin.Text == "+")
          {
              filesRptr.Visible = true;
              aneksyRptr.Visible = true;
  
              filesRptr.DataSource = Controller.ReadFilesByAgreement(Convert.ToInt32(lbl_numerUmowy.Text), 1);
              filesRptr.DataBind();
  
              aneksyRptr.DataSource = Controller.ReadFilesByAgreement(Convert.ToInt32(lbl_numerUmowy.Text), 2);
              aneksyRptr.DataBind();
  
              btnRozwin.Text = "-";
  
          }
  
          else
          {
              filesRptr.Visible = false;
              aneksyRptr.Visible = false;
              btnRozwin.Text = "+";
  
          }
  
      }
  
      protected void lbl_numerUmowy_Click(object sender, EventArgs e)
      {
          string numer_umowy = ((LinkButton)sender).Text;
          Page.Response.Redirect("~/SeeAgreementData.aspx?numer=" + numer_umowy + "&amp;email=" + Request.QueryString["email"]);
      }
  
  }
  </code></pre>