title: Inline script conditional statement inside a ListView
body: <p>I'm trying to display an image inside a ListView control based on the value of a databound property. I've tried two methods of doing this (one at a time) and both returned errors of "The server tag is not well formed". Consider the code below.</p>
  
  <pre><code>&lt;ItemTemplate&gt;
      &lt;div class="left"&gt;
  
      &lt;!-- Method 1 --&gt;
      &lt;img src="media-play-button.png" alt="Play" class="mediaplay noborder" runat="server" visible="&lt;%# Eval("MediaType").ToString() == "video" %&gt;" /&gt;
  
      &lt;!-- Method 2 --&gt;
      &lt;%# if (((MediaLink)Container.DataItem).MediaType == "video") { %&gt;
      &lt;img src="media-play-button.png" alt="Play" class="mediaplay noborder" /&gt;
      &lt;%# } %&gt;
  
      &lt;/div&gt;
  &lt;/ItemTemplate&gt;
  </code></pre>