How to set ImageUrl based on the value of a field in a gridview
<p>I have the following line of code which evaluates whether the value is true or false, if its true it will show an image if its false it shows a different one.</p>

<pre><code>&lt;itemTemplate&gt;
&lt;img alt="" id="Img1" 
 src='&lt;%# MyAdmin.GetCheckMark((bool)DataBinder.Eval(Container.DataItem, "ShowImg"))%&gt;' 
 runat="server" /&gt;&lt;/ItemTemplate&gt;
</code></pre>

<p>Can I customize the Eval part in the back end code in c# and then pass a different variable to it for example in C# I want to do</p>

<pre><code>  bool ImgFlag = false;
  if(Entity.ShowImg == false &amp;&amp; Entity.SomethingElse == true)
   {
      ImgFlag = true;
   }
  else if(Entity.ShowImg == false &amp;&amp; Entity.SomethingElse == false)
  {  
      ImaFlag = false;
  }
  else
  {
      ImgFlag = true;
  }
</code></pre>

<p>And then I want to use ImgFlag instead of ShowImg in my GridView on each row, so ImgFlag will determine which flag to show..</p>

<p>Or is there a better way?</p>

<p>The issue is that that eval depends now on two things.. not one as before.</p>

<p>Thank you</p>
