I am developing a website in Visual Studio 2013 (MVC) and I am trying to show the data in my Oracle Database in a GridView. I used the DataSet model and was able to get the data. However, it is very very slow. It takes minutes to load the page and it freezes (closes the Visual Studio) most of the time in the middle of the process.
Having this issue, I created a database model and wrote queries in C#. I passed the list of items returned using the controllers and then printed the data on a View like this:
@model List>
Location | Server Name | Policy | Start Date | Report Date | Status | State | Schedule | Type | Dest. Media Server | job ID |
---|
@foreach (var s in Model)
{
@foreach (var i in @s)
{
@i}
}
It works well in most cases where the returning list is small. The problem starts when the list is long. The page loads quickly but it freezes for a while (I assume that is because the for-loop is still running through the list when the page is loaded, creating new table rows)
My question is if there is a way to split the list into multiple pages using the method I used. And if not, is there anyway to use a webform to show the data in a list> ?
*I tried all kinds of tools visual studio offers but all of them are very slow.
Solutions1
This nuget package, Paged List Mvc, works great for me and is very flexible. You only have to add a parameter, (the page you want) to your call to the controller and it does the rest.
The only thing I have found it does not do easily is localizing the "First", "Next", "Previous" in text without hard coding the equivalents in whatever language you choose.
You can display the list as numbers to get around this.
Talk1:
Why would you want to localize the page numbers /within/ the grid? I don't believe I've ever seen that in an application.