O'Reilly logo

Getting Started with Knockout.js for .NET Developers by Andrey Akinshin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sending requests to the server

It is assumed that the main logic of the model processing is hosted on the server. Every action that we perform on the model should correspond to a method in the controller:

public class FooController : KnockoutController {
  public ActionResult FooAction(FooModel model)
  {
    model.FooAction();
    return Json(model);
  }
}

As you can see from the preceding example, the method takes the model parameter that the main model sent from the client side. ASP.NET maps it to a C# object. In other words, the model parameter contains the status of the client model at the time of sending. It is possible to perform the necessary manipulations on the model and send the updated model in the JSON format with help of return Json(model);. You ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required