title: ASP.Net repeater item.DataItem is null
body: <p>Within a webpage, upon loading, I fill a dataset with two table with a relation between those tables and then load the data into a repeater with a nested repeater. This can also occur after the user clicks on a button. The data gets loaded from a SQL database and the repeater datasource is set to the dataset after a postback. However, when ItemDataBound occurs the Item.Dataitem is always null.</p>
  
  <p>Why would this occur?</p>
  
  <p>Here is the databind code:</p>
  
  <pre><code>        this.rptCustomSpaList.DataSource = ds;
          this.rptCustomSpaList.DataBind();
  </code></pre>
  
  <p>Here is the ItemDataBound code:</p>
  
  <pre><code>        RepeaterItem item = e.Item; 
  
          Repeater ChildRepeater = (Repeater)item.FindControl("rptCustomSpaItem");
          DataRowView dv = e.Item.DataItem as DataRowView;
          ChildRepeater.DataSource = dv.CreateChildView("sparelation");
          ChildRepeater.DataBind();
  </code></pre>
  
  <p>below is my HTML repeater code</p>
  
  <pre><code>&lt;asp:Repeater ID="rptCustomSpaList" runat="server" 
   onitemdatabound="rptCustomSpaList_ItemDataBound"&gt;
      &lt;HeaderTemplate&gt;&lt;/HeaderTemplate&gt;
      &lt;ItemTemplate&gt;
          &lt;table&gt;
              &lt;tr&gt;
                  &lt;td&gt;&lt;asp:Label ID="Label3" runat="server" Text="Spa Series:"&gt;&lt;/asp:Label&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;asp:Label ID="Label4" runat="server" Text='&lt;%#DataBinder.Eval(Container.DataItem, "SPASERIESVALUE") %&gt;'&gt;&lt;/asp:Label&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt;&lt;asp:Label ID="Label5" runat="server" Text="Spa Model:"&gt;&lt;/asp:Label&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;asp:Label ID="Label6" runat="server" Text='&lt;%#DataBinder.Eval(Container.DataItem, "SPAMODELVALUE") %&gt;'&gt;&lt;/asp:Label&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt;&lt;asp:Label ID="Label9" runat="server" Text="Acrylic Color:"&gt;&lt;/asp:Label&gt;&lt;/td&gt;
                 &lt;td&gt;&lt;asp:Label ID="Label10" runat="server" Text='&lt;%#DataBinder.Eval(Container.DataItem, "ACRYLICCOLORVALUE") %&gt;'&gt;&lt;/asp:Label&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
    &lt;td&gt;
     &lt;asp:Label ID="Label11" runat="server" Text="Cabinet Color:"&gt;&lt;/asp:Label&gt;
    &lt;/td&gt;
    &lt;td&gt;
     &lt;asp:Label ID="Label12" runat="server" Text='&lt;%#DataBinder.Eval(Container.DataItem, "CABPANCOLORVALUE") %&gt;'&gt;&lt;/asp:Label&gt;
    &lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
    &lt;td&gt;
     &lt;asp:Label ID="Label17" runat="server" Text="Cabinet Type:"&gt;&lt;/asp:Label&gt;
    &lt;/td&gt;
    &lt;td&gt;
     &lt;asp:Label ID="Label18" runat="server" Text='&lt;%#DataBinder.Eval(Container.DataItem, "CABINETVALUE") %&gt;'&gt;&lt;/asp:Label&gt;
    &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
    &lt;td&gt;
     &lt;asp:Label ID="Label13" runat="server" Text="Cover Color:"&gt;&lt;/asp:Label&gt;
    &lt;/td&gt;
    &lt;td&gt;
     &lt;asp:Label ID="Label14" runat="server" Text='&lt;%#DataBinder.Eval(Container.DataItem, "COVERCOLORVALUE") %&gt;'&gt;&lt;/asp:Label&gt;
    &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/table&gt;
    &lt;asp:Label ID="Label15" runat="server" Text="Options:"&gt;&lt;/asp:Label&gt;
    &lt;asp:Repeater ID="rptCustomSpaItem" runat="server"&gt;
     &lt;HeaderTemplate&gt;
      &lt;table&gt;
     &lt;/HeaderTemplate&gt;
     &lt;ItemTemplate&gt;
      &lt;tr&gt;
      &lt;td&gt;
      &lt;asp:Label ID="Label1" runat="server" Text='&lt;%#DataBinder.Eval(Container.DataItem, "PROPERTY") %&gt;'&gt;&lt;/asp:Label&gt;
      &lt;/td&gt;
      &lt;td&gt;
      &lt;asp:Label ID="Label2" runat="server" Text='&lt;%#DataBinder.Eval(Container.DataItem, "VALUE") %&gt;'&gt;&lt;/asp:Label&gt;
      &lt;/td&gt;
      &lt;/tr&gt;
     &lt;/ItemTemplate&gt;
     &lt;FooterTemplate&gt;
      &lt;/table&gt;
     &lt;/FooterTemplate&gt;
    &lt;/asp:Repeater&gt;
    &lt;table&gt;
    &lt;tr&gt;
    &lt;td style="padding-top:15px;padding-bottom:30px;"&gt;
     &lt;asp:Label ID="Label7" runat="server" Text="Configured Price:"&gt;&lt;/asp:Label&gt;
    &lt;/td&gt;
    &lt;td style="padding-top:15px;padding-bottom:30px;"&gt;
     &lt;asp:Label ID="Label8" runat="server" Text='&lt;%#DataBinder.Eval(Container.DataItem, "SPAVALUEVALUE") %&gt;'&gt;&lt;/asp:Label&gt;
    &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/table&gt;
    &lt;asp:Label ID="Label16" runat="server" Text="------"&gt;&lt;/asp:Label&gt;
   &lt;/ItemTemplate&gt;
   &lt;FooterTemplate&gt;&lt;/FooterTemplate&gt;
  &lt;/asp:Repeater&gt;
  </code></pre>