Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,

While I am trying to bind the Model data using foreach loop in MVC, I am able to get lakhs of records in just 2-3 seconds at Controller side, but when the data goes from controller to view where I am using foreach, the performance is too slow which takes about more than 10 mins to bind just 50k records.

Below is my code sample :
HTML
@foreach (var device1 in Model.FaultyDevices)
{
    <tr>
        <td>
            @Html.DisplayFor(mod => device1.status)
        </td>
        <td>
            @Html.DisplayFor(mod => device1.pointAddress)
        </td>
    </tr>
}

Any help or suggestion on faster binding in html table would be greatly appreciated.

Regards,
Posted
Updated 18-Nov-15 20:49pm
v4

Creating such a large table is always going to be slow. No human being can possibly process that amount of information so the solution is to reduce what you display by using paging\filtering\sorting etc to show only relevant bits of data.
 
Share this answer
 
Rendering the table with such large records always going to take time. I'd suggest you to use the Grid instead. Or provide the paging feature for your table - that won't display all the data in one shot.

Refer this article about using the basic grid in MVC-
Using the Grid.MVC in ASP.NET MVC[^]
There are alternatives too for this grid, you can google it out :)


-KR
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900