Noah Blumenthal's Blog

July 10, 2009

jQuery plugin to edit table row (inline)

Filed under: jQuery — noahblu @ 6:00 pm

I just uploaded a jQuery plugin to turn a regular (non-souped-up) table’s rows into inline editable.  The url is

There are some instructions there too.  Feel free to modify.

Pretty simple but might save you some time if you’re going in this direction.

June 17, 2009

jEditable note: don’t return JSON (and how to return strings from ASP.NET MVC Actions)

Filed under: ASP.NET MVC,jQuery — noahblu @ 5:42 pm

jEditable is a cool jQuery plugin for inline editing.  I was toying around with it today and found an interesting ‘feature’: it expects a string response from the server.  Now that’s a problem because I was returning a JSON object so my string had quotes around it (Test became “Test”).  Ok, so I have to return a regular string.  I guess I just didn’t expect that because I’m used to my jQuery plugins expecting json (or at least accepting it).

Well, my Action returns an ActionResult because not always will it be accessed via jQuery (yup, this does not actually require javascript!).  I check the request (if (Request.IsAjaxRequest())) and proceed…
So, what I did was create a StringResult.  Much like the JsonResult class, the StringResult outputs the data you give it but it just outputs text.  Simple but effective, here’s the code:

public class StringResult : ActionResult
 private string _output;
 public StringResult(string output)
 _output = output;
 public override void ExecuteResult(ControllerContext context)
 HttpResponseBase response = context.HttpContext.Response;
 response.ContentType = "text/html";

Blog at