title: ASP.NET Custom Control - DataBinding
body: <p>I have my custom control inside of a formview.  This custom control has a variety of properties one of which is <code>Value</code> which I am trying to databind.</p>
  
  <p>Using <code>Container.DataItem</code> I can databind my control, and <strong>everything works</strong>:</p>
  
  <pre><code>&lt;fc:Literal runat="server" ID="readState" Label="State:" Value='&lt;%# Container.DataItem("ActivityState") %&gt;' /&gt;
  </code></pre>
  
  <p>Then when I try to databind using <code>Eval</code>, then it doesn't:</p>
  
  <pre><code>&lt;fc:Literal runat="server" ID="readState" Label="State:" Value='&lt;%# Eval("ActivityState") %&gt;' /&gt;
  </code></pre>
  
  <p>Gives the Error:</p>
  
  <blockquote>
    <p>Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.</p>
  </blockquote>
  
  <p>Everything workds great with <code>Container.DataItem</code>, so my question is: Why does <code>Container.DataItem</code> work and <code>Eval</code> doesn't?</p>