MVC with Bootstrap: Razor vs jQuery vs KnockoutJS

Recently I was in a situation to find a dynamic view engine technology to be used for my MVC with Bootstrap project. My basic need is to segregate the twitter bootstrap user interface from the rest of the code. So the user interface designer will be able to do changes in the view without any interference. At the same time the web applications needs several client side validation and dynamic changes involved in the user interface.

I had three familiar technologies to choose from. They are Razor view engine, jQuery or KnockoutJS view model. All these three technologies are useful for creating dynamic user interface. I’ve to decide the best view engine technology which suites my need. So, I’ve started with comparing the pros and cons of these technologies with my basic need in mind.

1. Razor View Engine

This is one among the view engines in MVC. It’s not a new language. So it’s easy to learn and easy to use.

If our goal is to get expedited development with an easy to use technology and reduce the effort of coding then MVC with razor view engine will be the best solution. But The UI segregation will not be what we expect. Even the JQuery or Java script coding will be very minor in this way we may need jQuery/JavaScript only for few customized validation or client side manipulations. Most of the time the Razor engine will itself create the client side java script with one line of code. The learning effort in Razor will be also minimum.

My Opinion: More productivity, Less UI segregation

2. JQuery (or Java Script) with ajax

As both JavaScript and jQuery are around for long time, the web developers are familiar with this. But the development effort is high compared to razor is high as it needs more coding than razor. With javascript/jQuery we can segregate most of the simple UI forms. But scenarios like generating multiple rows from a dataset and cascading controls based on date needs more coding and sometimes needs coding to be done around html tags or need to generate the html tags from the jQuery script. It’s unavoidable.

My Opinion: Medium productivity and Medium UI Segregation

3.KnockoutJS with ajax:

The main purpose of knockout is to segregate the UI totally and easily using  MVVM technology. It’s mainly designed based on the UI segregation pitfalls in jQuery and PrototypeJS. As this is relatively new technology there is a high learning curve. There will be slower production during the learning curve. Also just like jQuery we have to do more coding compared to razor.

My Opinion: Starts Low and then Medium productivity and More UI segregation


Finally we have decided to use KnockoutJS with Ajax for our project.

What do you think? You might have faced similar situations when identifying the technology for your product. Please share your ideas!..

1 thought on “MVC with Bootstrap: Razor vs jQuery vs KnockoutJS”

Leave your thoughts...

This site uses Akismet to reduce spam. Learn how your comment data is processed.