Bind table in ASP.NET MVC web application calling Web API with JQuery Ajax using DataTables
Introduction In this article will see how to bind a table in ASP.NET MVC web application calling Web API with JQuery Ajax using DataTables plugin.
Prerequisite
Zeal to learn. Visual Studio – 2012 and above.
MVC Web Development Start with developing a basic web application. Below is asp.net MVC web application page with static data bind to table. Model:
Model with Productclass
Controller:
With static data list of Product class. static List<Product> products = new List<Product>() { new Product() {Static Data… } }
Action Method, public ActionResult Index() { return View(products); }
View:
With a plain HTML table looping in with Model. <table id="products" class="table table-bordered table-hover"> ... </table>
Build and Run,