Overview
2. Add a controller “HomeController” and “Index” view.
3. Now we will add the required scripts. Make the following changes in App_Start -> BundleConfig.cs and Views->Shared->_layout.chtml.



- In the view we need to first add the reference of the product.js.
- Next we need to bind our viewmodel with the view using the applyBindings method.
- Next we are using with: binding to bind the currentProduct view model property to the product section (<div>) and also bind the child controls with the currentProduct sub properties. So whenever there is a change in the control value it will be reflected in the currentProduct object.
6. Now at this point we are ready to run the application and we should see the index view auto-populated with the product information. Now press F5.
7. Now there are the following two ways to POST the data to an MVC action:

- Using $.ajax (ajax call to post the data): In this case the MVC action should return the JsonResult and control will return to the callback function either in SUCCESS or ERROR. But we can't use this approach if we want to redirect our control to some other action.
- Another way is to use a Knockout builtin function (ko.postJSON). Here you can redirect to some other page after saving.











Bhuvanesh MohankumarPosted May 3, 2016, 12:41 PM
Great
Gowtham RajamanickamPosted Apr 25, 2015, 5:56 AM
good
Mahesh ChandPosted Mar 4, 2014, 2:50 PM
Good stuff Manish. Welcome to C# Corner.