title: Inline Code in ListView in ASP.NET Webforms?
body: <p>I am trying to use a ASP.NET WebFroms ListView with inline code (for globalization, Frame.Article comes from an resx file):</p>
  
  <pre><code>      &lt;asp:ListView runat="server" ID="demo" ItemType="Quarters&lt;int&gt;"&gt;
          &lt;LayoutTemplate&gt;
                      &lt;strong&gt;&lt;%# Frame.Article %&gt;&lt;/strong&gt;                        
                      &lt;strong&gt;&lt;%# Frame.Customer %&gt;&lt;/strong&gt;   
                      &lt;asp:PlaceHolder runat="server" ID="itemPlaceholder" /&gt;  
          &lt;/LayoutTemplate&gt;
          &lt;ItemTemplate&gt;
              &lt;p&gt;&lt;%# Item.Q1 %&gt;&lt;/p&gt;
          &lt;/ItemTemplate&gt;
      &lt;/asp:ListView&gt;
  </code></pre>
  
  <p>Code Behind:</p>
  
  <pre><code> Quarters&lt;int&gt; quarter = new Quarters&lt;int&gt;();
   quarter.Q1 = 10;
   quarter.Q2 = 20;
   quarter.Q3 = 30;
   quarter.Q4 = 40;
  
   demo.DataSource = new List&lt;Quarters&lt;int&gt;&gt;(){quarter};
   demo.DataBind();
  </code></pre>
  
  <p>But I always get this error:</p>
  
  <blockquote>
    <p>Compiler Error Message: CS1061: 'System.Web.UI.WebControls.ListView'
    does not contain a definition for 'DataItem' and no extension method
    'DataItem' accepting a first argument of type
    'System.Web.UI.WebControls.ListView' could be found (are you missing a
    using directive or an assembly reference?)</p>
  </blockquote>
  
  <p>Is there anyway to make this work?</p>