How to speed up loading nearly 30 thousand records?
How to speed up loading nearly 30 thousand records?
mce
Posts: 6Questions: 1Answers: 0
Hello all,
I am going to load a lot of records via my c# programs GridView control - but it takes about 1 minute before all data has been rendered using DataTables.net.
So therefore I will ask about the following: Can I (maybe via a ajax call) load fewer records at a time via pagination - so if I choose to show 50 records at each page, then I only need to fill in 50 records to my GridView control?
Is that possible - or is there another method?
Best regards,
Michael
Answers
Datatables has Server Side Processing to support server based paging. Your server script will need to support the SSP Protocol. Not sure if your environment will with with any of the Editor libraries. If so this blog shows how to use them for SSP.
Kevin
Thanks for answering
But should I create a WebMethod in C# and return a DataSet to the ajax call? And in which way can I find out a start record to show and how many records I have to return - in according to pagination? Is it variables I can read and transfer to the WebMethod?
Thanks for an example -
Thanks in advance.
Yes.
The SSP Protocol docs explain the paging, search and sort values sent to the server and what is required in the response. Let us know if you have any questions about the protocol.
Here are some live examples:
https://datatables.net/examples/server_side/index.html
Kevin
Hello again ...
I can see some Sent parameters - but where do I need to fill in "start" and "length" - and which variables contain the current values to start and lenght - so I can increment/decrement them? Is it something like:
Thanks in advance.
Michael
When you enable the
serverSide
processing option, by setting ittrue
, Datatables will automatically send those parameters.Kevin
Thank you very much
But when I normally create a webmethod in C# - I need to create some parameters too, so I can transfer values from Javascript to C# - but is it possible for assistance to how I can create a C# webmethod for connecting with DataTables? Im wondering how I can read start and lenght in my C# Webmethod...
Should the Webmethod look something like this:
Sorry I don't know anything about C# Webmethod. Maybe the developer Allan does. However Datatables just sends standard Ajax requests to the server. Maybe this SO thread or others will help you to read the parameters sent.
This example shows how to add additional parameters to send to the server.
Kevin
Thank you very much - I will take a look at SO too ...
Thanks for your assistance too