Chapter 6. Working with Forms

If  you experimented in the preceding chapter, you will have noticed that the scaffolded AuthorsController is fully functional in terms of adding, editing, and deleting records from the Author table. This in itself makes it quite useful; however, this chapter will demonstrate how to integrate Knockout and Bootstrap into the form as well as a little jQuery to submit the form via AJAX.

Upgrading Bootstrap

When I introduced the NuGet Package Manager, I mentioned updating the existing packages to their latest versions. The version that is installed with MVC is version 3.0 and some of the features used in this chapter (and future chapters) use the documentation from version 3.3.

If you didn’t update the packages back in Chapter 3, I would encourage you to do it now by following these steps:

  1. Right-click the project and select Manage NuGet Packages.
  2. On the left, select the Update option. This will search online for any updates to all of the packages currently installed.
  3. If you are comfortable with updating all packages, you can click the Update All button, or you can find just the Bootstrap package and update it individually.

Integrating Knockout with a Form

This chapter will start to demonstrate why I love working with these three technologies together. It’s going to take a nice-looking form and add some usability to it. In fact, no changes are required to the AuthorsController.

Back in Chapter 4 when the Author and Book models were created, I didn’t ...

Get ASP.NET MVC 5 with Bootstrap and Knockout.js now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.