---
title: "How to bind products list in knockoutjs with Mvc"  
description: "How to bind products list in knockoutjs with Mvc"  
author: "Anonymous User"  
published: 2015-10-15  
updated: 2015-10-15  
canonical: https://www.mindstick.com/forum/33513/how-to-bind-products-list-in-knockoutjs-with-mvc  
category: "asp.net mvc"  
tags: ["jquery", "mvc4", "entity framework", "knockout.js"]  
reading_time: 1 minute  

---

# How to bind products list in knockoutjs with Mvc

Can [anyone](https://www.mindstick.com/articles/23207/how-to-find-the-best-fit-job-for-anyone) please help me how to [solve this problem](https://answers.mindstick.com/qa/94681/my-google-assistant-shows-completely-different-search-results-from-what-i-ask-how-can-i-solve-this-problem).

## Replies

### Reply by Anonymous User

```
<!DOCTYPE html><html><head>    <meta name="viewport" content="width=device-width, initial-scale=1">     <script src="/Scripts/jquery-2.1.4.min.js"></script>  <script src="/Scripts/knockout-3.3.0.js"></script> </head><body><div id="demo"><table>    <thead>        <tr>            <th>Product Id</th>            <th>Product Name</th>            <th>Price</th>            <th>Description</th>        </tr>    </thead>    <tbody databind="foreach:Products">        <tr>   <td><label data-bind="text:ProductId"></label></td>      <td><label data-bind="text:ProductName"></label></td>      <td><label data-bind="text:Price"></label></td>      <td><p data-bind="text:Description"></p></td>        </tr>    </tbody></table> </div><script>function viewModel() {    var self = this;self.Products
= ko.observableArray();     $.getJSON("/Home/Products", function (data) {        self.Products (data);    }); }$(function () {    var NewViewModel = new viewModel ();    ko.applyBindings(NewViewModel,
document.getElementById("demo")); });</script></body></html>
public class HomeController : Controller{ public JsonResult Products () {  var data = db.Database.SqlQuery<Manufacturers>(@"SELECT DISTINCT ProductId ,  ProductName,Price,Description FROM products_table").ToList();  return Json(data, JsonRequestBehavior.AllowGet); }}
```


---

Original Source: https://www.mindstick.com/forum/33513/how-to-bind-products-list-in-knockoutjs-with-mvc

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
