This is a migrated thread and some comments may be shown as answers.

GridView is not responding when pasted more than 8000 records from excel

4 Answers 80 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Sree
Top achievements
Rank 1
Sree asked on 03 Jan 2013, 07:55 AM
Hello Telerik Team,
I have a radgridview in my winforms application and i have a requirement where user will copy some fields of data from excel and pastes in the gridview, its is working perfect upto 1000 records pasting with a performance speed up to 40 sec, but when tried to paste more than 1000 it is taking time in minutes, after tried of pasting rows  more than 8000 , the form is not responding and application has hanged

i need the feature exactly how excel interacts with clipboard, but is there any limitation in clip board copy and pasting to radgird ??? i have checked the below possible threads, but couldn't find the answer

http://www.telerik.com/community/forums/winforms/gridview/paste-from-excel.aspx

http://www.telerik.com/support/kb/winforms/gridview/copy-pasting-rows-in-and-between-radgridviews-csv-format.aspx

can you please help

4 Answers, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 07 Jan 2013, 02:57 PM
Hi Lakshmi,

Please give us a more detailed description about your scenario and share with us the used RadGridView columns setup and your Excel selection range for copy operation. Please also send us a copy of your Excel file to recreate the scenario locally and investigate the performance issues.

Thank you for your time and cooperation.

Regards,
Julian Benkov
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
0
Sree
Top achievements
Rank 1
answered on 08 Jan 2013, 12:57 AM
Hello Team,

here is the grid with 6 columns, to this 6 columns, user will copy and paste the data from excel, its a simple grid with defined columns,it is working fine when copied 1000 records, and not responding when tried to copy more than 8000 records from excel
and also i haven't written any events for the grid, so no event is firing during pasting
i tested that also, if the same clip board copy is working in fraction of seconds with excel, why can't gridview reciprocating it


               AD
                BD                 CD                 DD               ED
12.01 22.01 33.768 2.12344 5655.34
13.01 23.01 34.768 2.12344 5656.34
14.01 24.01 35.768 2.12344 5657.34
15.01 25.01 36.768 2.12344 5658.34
16.01 26.01 37.768 2.12344 5659.34
17.01 27.01 38.768 2.12344 5660.34
18.01 28.01 39.768 2.12344 5661.34
19.01 29.01 40.768 2.12344 5662.34
20.01 30.01 41.768 2.12344 5663.34

Excel values are like above, you can increment each column value by control drag untill 12000 records and do a test
0
Accepted
Julian Benkov
Telerik team
answered on 10 Jan 2013, 02:16 PM
Hi Lakshmi,

The problem in this situation is that the Excel copy its content in Html, Text and other formats and RadGridView first tries to parse and paste the data using Html format. The built-in simple html parser is slow in this scenario and it is not optimized for this huge amount of data. To bypass this default processing you can remove Html data from the Clipboard and RadGridView will paste data using simple text format and text parser, which is 20x faster than html parsing. Here is a solution example:
using System;
using System.Windows.Forms;
using Telerik.WinControls.UI;
 
namespace Lab.Grid
{
    public partial class GridCopyPaste : MainForm
    {
        private RadGridView gridView = new RadGridView();
 
        public GridCopyPaste()
        {
            InitializeComponent();
 
            this.gridView.Dock = DockStyle.Fill;
            this.gridView.Parent = this;
            this.gridView.BringToFront();
 
            gridView.MultiSelect = true;
        }
 
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
 
            this.gridView.GridBehavior = new MyBehavior();
            this.gridView.ColumnCount = 6;
            this.gridView.RowCount = 10;
        }
 
        class MyBehavior : BaseGridBehavior
        {
            public override bool ProcessKeyDown(KeyEventArgs keys)
            {
                if (keys.Control && keys.KeyCode == Keys.V)
                {
                    Clipboard.SetData(DataFormats.UnicodeText, Clipboard.GetData(DataFormats.UnicodeText));
                }
 
                return base.ProcessKeyDown(keys);
            }
        }
    }
}

You can use this approach to optimize your application.

I hope this helps.

Regards,
Julian Benkov
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
0
Sree
Top achievements
Rank 1
answered on 14 Jan 2013, 08:48 AM
Hello Julian,

Thanks its working like charm, thank you so much :)
Tags
GridView
Asked by
Sree
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
Sree
Top achievements
Rank 1
Share this question
or