Bind filtered record in nested HTML Table using jQuery Ajax in ASP.Net MVC

on Sep 22, 2021 07:10 AM


I am using this Bind Nested List using Model in ASP.Net MVC

It works well, the only problem i see is that the second Model model.orders- its generating whole list first then in razor view its filter the data, which is heavy process

How we can generate order model based on customerid so in razor we can just bind filtered data

Please advice

NorthwindEntities entity = new NorthwindEntities();
Result model = new Result();
model.Customers = entity.Customers.Take(3).ToList();
model.Orders = entity.Orders.ToList();
Download FREE API for Word, Excel and PDF in ASP.Net: Download
on Sep 22, 2021 07:21 AM

You can't bind the data in one model.

After binding each customer record you need to nake ajax call and bind the Order data. 

Refer below example.

Populate nested HTML Table with Searching and Paging using jQuery Ajax in ASP.Net