Applying JS functions to returned row data

Aug 19, 2011 at 7:21 PM

Hi O,

I've been having quite a bit of success using MVC Awesome with a project that I've been working on. Thanks for all of work that you've put in to this.

I have a quick question that I could use your assistance on. I have a jquery library that converts UTC time into the timezone that the browser is currently set to. While I can get the function to apply to a general DateTime on the cruds page, I am unable to apply the function to row data returned from the server. I'm guessing that my function needs to be in the function that receives data from the server, I'm just not sure of where that is. Example is below:


cruds.cshtml contains:

<span class="localtime">@DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ssZ")</span>

which works fine.

rows.cshtml contains:

<span class="localtime">@o.CreatedUtcDate.ToString("yyyy-MM-dd HH:mm:ssZ")</span>

which isn't working

The jquery library reference is located in the heads.ascx file as follows:

<script src="<%=Url.Content("~/Scripts/jquery.localtime-0.4.js")%>" type="text/javascript"></script>

Thanks in advance.

Aug 20, 2011 at 9:26 AM


  $('#sform').ajaxForm({ success: function (d) {



and here


   function create(o) { $.get('@Url.Action("row")', { id: o.Id }, function (d) { addStart(d); }); }
   function edit(o) { $.get('@Url.Action("row")', { id: o.Id, ie8: Math.random() }, function (d) { $("#o" + o.Id).before(d).remove(); $("#o" + o.Id).hide().fadeIn('slow'); }); }