title: Telerik grid ClientTemplate
body: <p>I'm trying to use C# to apply a bit of logic when displaying a DateTime in a telerik grid in my MVC application, but am having some trouble getting it working. My first problem is that I don't understand exactly how the ClientTemplate call works. I wasn't able to find documentation explaining how it works, either. So, an explanation of how that works would be helpful, and then maybe specifically what's wrong with my example:</p>
  
  <pre><code>columns.Bound(p =&gt; p.SetupDate).ClientTemplate("&lt;#= SetupDate == DateTime.Min || SetupDate == null ? string.empty : SetupDate #&gt;")
  </code></pre>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I went with Daniel's suggestion. I just call this function from ClientTemplate(). Here is the final code:</p>
  
  <pre><code>// Setup a minDate to mimic C#'s Date.MinDate constant.
  var minDate = new Date();
  minDate.setFullYear(1, 0, 1);
  minDate.setHours(0, 0, 0, 0);
  
  function checkDateWithFormat(d, f)
  {
      if (d.getTime() == minDate.getTime())
      {
          return "";
      }
      else
      {
          return d.toString(f);
      }
  }
  </code></pre>