Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

when to use knockout javascript with ASP.NET MVC

What factors should I consider before adopting the Knockout JavaScript library for my application?

Currently I have a ASP.NET MVC 2 site. Most of the navigation and set up of the site is simple get and post actions. There are views which have grids / multiple grids where the data is view only. All the ajax and javascript is being handled using JQuery. JSON returned from Controllers are few and sparsely used. Most of the ajax grids are implemented by sending HTML using partial views.

like image 813
frictionlesspulley Avatar asked Jan 26 '11 18:01

frictionlesspulley


People also ask

Why do we use knockout JS?

Knockout is a JavaScript library that helps you to create rich, responsive display and editor user interfaces with a clean underlying data model.

Is knockout JS MVC?

Knockout JS is a fantastic library when you are looking for a drop-in enhancement that brings in client side data-binding and elements of the MVVM design pattern into your website that's a potpourri of Razor syntax, server side Html Helpers and jQuery plugins.

What is Knockout JS in asp net?

Knockout. Js (simply KO) is a powerful JavaScript library which allows developers to bind DOM elements with any data model like array, Json etc.

Where is knockout js used?

Knockout. js is a minimalist JavaScript framework for web application development. It is a JavaScript library that allows binding HTML elements against any data model. It is primarily used for creating rich and responsive display as well as editor user interfaces with a clean, underlying data model.


1 Answers

There are many factors but one thing which i've found very helpful:

When you have UI elements which are to be updated AND are sporadically distributed in your webpage e.g. When you want to add a new job experience, want to show the notification of successful addition on top of the page and increase the count somewhere on the right menu etc. If you use MVC ajax helpers then you would need to specify a single element which needs to be updated with ajax content or write your own huge jQuery.ajax thing. Knockout really simplifies this scenario.

like image 113
neebz Avatar answered Oct 23 '22 12:10

neebz