-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Getting Started with Knockout.js for .NET Developers
By :
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 should pay attention to the fact that the base class for the controller is KnockoutController. This base class contains the extended logic to work with the JSON format.
For example, you can create a special control to send requests to...
Change the font size
Change margin width
Change background colour