title: DataItem on Repeater.Items is always null
body: <p>I am setting the DataSource of my repeater to a List (MyProducts is a simple class, consisting of only get/setters).</p>
  
  <p>After this and DataBind(), I can see in debugging mode that DataItem of each Repeater.Items is null. When making a postback and trying to update MyProducts, the Repeater.Items[n].DataItem is still null and Im not able to cast it, to do my work.</p>
  
  <p>Why isn't DataItem set on each RepeaterItem, when I databind my repeater? I cant figure/Google it out. Every other aspect of my code works correctly (outputting data from MyProducts to aspx, using for instance: </p>
  
  <pre><code>&lt;asp:TextBox runat="server" id="q" Text='&lt;%# DataBinder.Eval(Container.DataItem, "Quantity")%&gt;'&gt;&lt;/asp:TextBox&gt;
  </code></pre>
  
  <p>More code:</p>
  
  <pre><code>public class MyProducts
      {
          public string Number
          {
              get; set;
          }
  
          public decimal Price
          {
              get; set;
          }
  
          public decimal Quantity
          {
              get; set;
          }
  
          public decimal Total
          {
              get { return Quantity * Price; }
          }
      }
  </code></pre>
  
  <p>Generating:</p>
  
  <pre><code>public List&lt;MyProducts&gt; TheProducts
  {
   get { // Invoking webservice, getting response as xml and converting it to a list of MyProducts }
  }
  </code></pre>
  
  <p>My user control:</p>
  
  <pre><code>// Bind products in cart
  r.DataSource = TheProducts;
  r.DataBind();
  // Debugging "r.Items[n].DataItem" now shows "null", eventhough all objects has been correctly binded
  </code></pre>
  
  <p>Edit #2, the debugging info. DataSource gets correctly loaded, but Repeater.Items[3].DataItem is null. It should have a value, right?
  <a href="http://skill.dk/dataitem.gif" rel="nofollow">screenshot</a></p>
  
  <hr>
  
  <p>Edit #3,
  I get it now, I thought DataItem was always accessible when DataSource is set, and did not think of including the full code (I tried to access it in Page_Load).</p>
  
  <p>After the user has edited an quantity value, I wanted to save the new quantity for a MyProducts. I solved it by placing a hiddenfield which holds the id of MyProducts, so that I can manually look it up and get the MyProducts object from there.</p>
  
  <p>Thanks to emremp, Mark Avenius and all others who pitched in.</p>