Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#3.0 C# ASP.NET Silverlight C#4.0 , +
My code is gridview.datasource=a (a is list whcih has 20 thousand ),the speed is so slow;
my idea is when user firstly enter the web page , I set gridview.datasource=a1 (a1 is the first 1 thousand rows of data in a);
and than I set gridview.datasource=a1 (a1 is the first 2 thousand rows of data in a);
....
and than I set gridview.datasource=a19 (a1 is the first 19 thousand rows of data in a);
and than I set gridview.datasource=a20 (a1 is the first 20 thousand rows of data in a);

but it seems doesn't work, how to solve it ?
 
Can you give me some example to use gridvie to show large amount of data quick in a web page?Thank you!
Posted 7-Aug-12 7:44am
Comments
lewax00 at 7-Aug-12 14:13pm
   
Is it slow on the machine hosted the server (e.g. when you debug it locally), or just when someone loads it remotely? Because if it's the latter then there isn't much you can do, a lot of data being displayed means a lot of data has to be transferred, and that takes time based on your network connection.
PEIYANGXINQU at 7-Aug-12 14:17pm
   
Both, I think we can optimize this.
Wes Aday at 7-Aug-12 14:22pm
   
It's called paging. Besides that, no one is going to look at 20K rows of data. No reason at all to be doing that to begin with.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

You should probably use the built in paging features of the GridView class (see ^])
 
That's a lot of data for a web page, think about it:
Let's assume you only have one column, each entry empty, and the encoding is UTF-8
The GridView will generate a table, each row needs "<tr>" and "</tr>" (9 bytes), and each item needs "<td>" and "</td>" (9 bytes), so:
20000 * (9 bytes per row + 1 item per row * 9 bytes per item) = 360,000 bytes, just for the markup with one column. But your data probably has more columns, and the values of your entries each add to that data. That's a lot of data to transfer all at once, and it will be slow. If you page it, you only have to send them a little at a time, and it will be much faster.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

There is code for this in WPF, you should however be able to translated it to Silverlight without big issues:
http://bea.stollnitz.com/blog/?p=344[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

the best option is paging which loads minimum pages records only as a result pages load fast, it ignore large numbers of data.
  Permalink  

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

  Print Answers RSS
0 mhegazy94 488
1 Sergey Alexandrovich Kryukov 375
2 Kornfeld Eliyahu Peter 285
3 Sibeesh KV 251
4 Gihan Liyanage 189
0 Sergey Alexandrovich Kryukov 6,775
1 OriginalGriff 6,696
2 CPallini 5,345
3 George Jonsson 3,599
4 Gihan Liyanage 2,751


Advertise | Privacy | Mobile
Web03 | 2.8.140922.1 | Last Updated 16 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100