locked
datagrid is incredibly slow, need help RRS feed

  • Question

  • The datagrid takes over a minute to display only 1,700 row and 4 columns of data.  Here are the details:

    - It is a Silverlight 4 application
    - In a scrollviewer, I have a stackpanel
    - In the stackpanal, I have a chart followed by the datagrid
    - The datagrid does not have its height set

    From the time I get the data back from my asychronous call and set the itemsource to the time the datagrid is displayed is over 60 seconds.  During which time, the Silverlight application freezes.

    If I set the height of the datagrid to like 500, the problem goes away.  This causes the datagrid to have a vertical scrollbar and this solution is not an option in my case.  The end users need to use the scrollbar on the parent scrollviewer to view everything (charts, datagrids, etc.) and multiple scrollbars is not an option.

    I have tried other datagrids to no avail.  Someone mentioned that if the height is set, the problem may go away and I hard-coded the height to be the height to show exactly 1,700 records and that did not improve the speed.

    Hopefully, someone is working on improving this.  Over a minute to display 1,700 records is ridiculous.

    Any ideas?

     

    Friday, May 28, 2010 12:40 PM

Answers

  • hmm, well if it is for printing, and printing from silverlight is the option. then i guess paging is out of the question. Have you tried debugging the method that returns the data on your web service...before it comes back to silverlight..how long it takes to get the data from db? If it is in milli sec then you could actually go for MVC and display the data in plain HTML for printing. Why bring it to silverlight when you can load the same data in ASP.NET for printing by opening a new popup window. i am guessing that this is for printing purpose. Possibly you could save more time in this way.

    Sharker Khaleed Mahmud

    Friday, May 28, 2010 2:36 PM

All replies

  • Setting the height will cause the datagrid to be virtualized so it only shows 100 rows instead of 1700 for example which will speed things up.  f that is not an option how you are defining the columns for the datagrid?  Maybe there is something slowing it down in there.

    Friday, May 28, 2010 1:05 PM
  • The DataGrid uses virtualization to help improve performance by only rendering the records that are on screen - hence your problem dissappeared when the DataGrid was restricted to 500px.  Without that restriction the DataGrid will grow as large as it needs to show all the records and unfortunately, perform poorly as a result.  I can see two potential solutions ...

    Is it possible to group your data rows thus allowing the user to expand/collapse different sections of data?  That would speed up performance, until of course the user expanded all the sections...

    Or is there a way to rework your gui such that a data grid scroll bar is used instead of scrolling the entire page?  From a user experience standpoint, scrolling through 1700 records must be a nightmare and I doubt that anybody could really comprehend that amount of information anyways.

     

    Friday, May 28, 2010 1:11 PM
  • 1700 records is a lot of information for the user to go through. Would it not be simpler that your show only 100 records and the rest go for paging...or is that not an option? cauz look at search engine, even though they have 5000 match in some point second...they only shows 20 records+ and then go for paging ;-)

    Sharker Khaleed Mahmud

    Friday, May 28, 2010 1:19 PM
  • Paging is not a great option for me because the users typically want to print the screens and if I used paging, only the current page's data would be printed.  I experimented with setting the height to 500 and then if the user clicked my "Print" button, I would clear the height setting, but then the application hangs at that point for over a minute.  It is either pay up front or pay later.

    I am a Silverlight fan, but it should not take that long to display 1,700 records.  It is a problem.  It would not take that long in HTML or even a Windows Forms application.

     

    Friday, May 28, 2010 2:22 PM
  • hmm, well if it is for printing, and printing from silverlight is the option. then i guess paging is out of the question. Have you tried debugging the method that returns the data on your web service...before it comes back to silverlight..how long it takes to get the data from db? If it is in milli sec then you could actually go for MVC and display the data in plain HTML for printing. Why bring it to silverlight when you can load the same data in ASP.NET for printing by opening a new popup window. i am guessing that this is for printing purpose. Possibly you could save more time in this way.

    Sharker Khaleed Mahmud

    Friday, May 28, 2010 2:36 PM