title: ASP.Net Repeater Eval in an If statement
body: <p>So I've been looking around for a good answer to this question, but haven't really found anything useful. Hopefully someone can shed some light on this for me.</p>
  
  <p>Basically, I have a repeater that is backed by a database table. Inside the ItemTemplate for this repeater, I have some HTML elements that are populated with properties from each item in the list. Pretty standard stuff. However, there is a possibility that one of the items could be null. In that case, it would make sense for me to put some sort of <code>if (blah != null)</code> logic around the offending code. The only problem is, when I've tried to do so, ASP throws up on me, telling me that I can't use an if statement inside of <code>&lt;%# %&gt;</code>. </p>
  
  <p>My question to the masses is this: if you can't use an if statement inside of <code>&lt;%# %&gt;</code>, then how are you supposed to do conditional logic based on the values of each item?</p>
  
  <p>I know that you can call your own methods inside the repeater, but that won't work for what I'm trying to do. </p>
  
  <p>Below is what I'm trying to accomplish, to better illustrate my point.</p>
  
  <pre><code>&lt;asp:Repeater runat="server" ID="repeater"&gt;
      &lt;ItemTemplate&gt;
          &lt;div class="item-wrap"&gt;
              &lt;% if(Eval("imageUrl") != null) { %&gt;
              &lt;div class="plan-img"&gt;
                  &lt;asp:Image runat="server" ImageUrl='&lt;%# Eval("imageUrl") %&gt;'/&gt;
              &lt;/div&gt;
              &lt;% } %&gt;
          &lt;/div&gt;
      &lt;/ItemTemplate&gt;
  &lt;/asp:Repeater&gt;
  </code></pre>