title: ASP.Net C# ListView inline conditions
body: <p>In have a list of objects bound to a ListView that is used to make a nice list of these items. In this ListView I have 1 column that shoud have a specific condition to display a specific string. Is this possible using inline code or should I get a workaround using the codebehind?</p>
  
  <p>This is what I would like to do:</p>
  
  <pre><code>&lt;% if (((Recipe)Container.DataItem).Status == RecipesModel.REJECTED) { %&gt;
  Something goes here
  &lt;% } %&gt;
  </code></pre>
  
  <p>But this returns this exception:</p>
  
  <pre><code>The name 'Container' does not exist in the current context
  </code></pre>
  
  <p><strong>EDIT</strong>: this code is used inside <code>&lt;ItemTemplate&gt;</code></p>
  
  <p><strong>EDIT 2</strong>: I found myself using the following code for this problem:</p>
  
  <pre><code>&lt;asp:PlaceHolder id="place_public" runat="server" Visible='&lt;%# ((Recipe)Container.DataItem).Status == RecipesModel.VALIDATED %&gt;'&gt;
  Something here
  &lt;/asp:PlaceHolder&gt;
  </code></pre>