title: How to call a javascript function inside kendo grid column template with razor syntax
body: <p>I have implemented a Kendo Grid with MVC4 and Razor syntax.  This grid displays log entries from a database table.  The LogText column contains text with Windows newline characters.  I am trying to replace those newline characters with line break tags.  To do this, I have created a javascript function that I am wanting to call from a column template.  The grid uses server binding.  I cannot seem to find the correct syntax to make a javascript call from within the template.  I have seen many examples, but none seem to be with the Razor syntax.  I hope someone can help me with this.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>@model IEnumerable&lt;Core.Models.ShipmentLog&gt;
  
  @{
      ViewBag.Title = "ShipmentLog";
  }
  
  &lt;h2&gt;ShipmentLog&lt;/h2&gt;
  @(Html.Kendo().Grid(Model)
      .Name("ShipmentLogGrid")
      .Columns(columns=&gt;
      {
          columns.Bound(bl =&gt; bl.UserName);
          columns.Bound(bl =&gt; bl.LogTime);
          columns.Bound(bl =&gt; bl.LogType);
          columns.Bound(bl =&gt; bl.LogText).Width(600).Encoded(false).Template(#=  GetHtmlNewLinesString(@item.LogText) #);
  
      })
  
  )
  
  &lt;div&gt;
      @Html.ActionLink("Back to List", "Index")
  &lt;/div&gt;
  
  &lt;script type="text/javascript"&gt;
      function getHtmlNewLinesString(text) {
          return text.replace('\n/g', '&lt;br /&gt;');
      }
  &lt;/script&gt;
  </code></pre>