title: How to implement conditional formatting in a GridView
body: <p>I have a GridView on my aspx page which displays a collection of objects defined by the following class</p>
  
  <pre><code>public class Item
  {
      public string ItemName{get; set;}
      public object ItemValue{get; set;}
  }
  </code></pre>
  
  <p>Then in my aspx markup I have something like this</p>
  
  <pre><code>&lt;asp:GridView ID="MyTable" runat="server"&gt;
      &lt;Columns&gt;
          &lt;asp:BoundField DataField="ItemName" /&gt;
          &lt;asp:BoundField DataField="ItemValue" /&gt;
      &lt;/Columns&gt;
  &lt;/asp:GridView&gt;
  </code></pre>
  
  <p>What I want to know is:<br/><i>
  Is there a way to use conditional formatting on the ItemValue field, so that if the object is holding a string it will return the string unchanged, or if it holds a DateTime it will displays as DateTime.ToShortDateString().</i></p>