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

I am trying to bind the model data into html table in my mvc application and able to get the data in UI in fraction of seconds. But when the records are more than 25k, it takes 15-20 seconds to bind.

Below is my code :

cshtml :
HTML
<tbody id="faultydevice-container">
            @foreach (FaultHandlingReportFaultyDeviceDataViewModel device1 in Model.FaultyDevices)
            {
                <tr>
                    <td>
                        @device1.status
                    </td>
                    <td>
                        @device1.pointAddress
                    </td>
                    <td>
                        @device1.Description                       
                    </td>
                    <td>
                        @device1.eventTime
                    </td>
                    <td>
                        @device1.eventResetTime
                    </td>
                </tr>
            }
        </tbody>


Note : I am not using entity framework to get the data. Instead, just calling the stored procedure to bind the records into a list. i.e., using ORM

Can anyone please suggest the way to bind huge data into html table ?

Thanks in advance,
Posted
Updated 12-Nov-15 20:11pm
v7
Comments
Krunal Rohit 28-Oct-15 5:24am    
Do with Paging. Or rather use Grid.

-KR

1 solution

Creating large tables is always going to be slow. If a user spent 3 seconds on each of your rows it would take 20 hours to process the whole table, so you are obviously generating a lot of meaningless data the user ignores. There is no fast way to do what you want to do, instead you should implement paging\filtering\searching so that users only see the data they are interested in, or if you must give them tens of thousands of rows they at least only see the first page if they're not interested in the rest.
 
Share this answer
 
Comments
Raj.rcr 30-Oct-15 3:49am    
Hi.. Is there any other way without using paging\filtering\searching concepts ?
F-ES Sitecore 30-Oct-15 4:21am    
Not really, no. You could make ths site responsive while it loads by maybe using ajax to download and add 100 rows at a time to stop everything being done in one hit, but it will still take a lot of time to render.

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