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

Multiple view models

Another important task in real projects is combining several views on the same page. In other words, you separated Models and their corresponding separated Views (in different files), but you want to display all Views at the same time. So, let's consider the following example.

The Model will be as follows:

public class BookModel { public string Title { get; set; } public string Author { get; set; } } public class LibraryModel { public string LibraryName { get; set; } public List<BookModel> Books { get; set; } } public class ReaderModel { public string FirstName { get; set; } public string LastName { get; set; } public BookModel FavoriteBook { get; set; } } public class MultipleViewModel { public LibraryModel LibraryModel { get; ...

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