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

Weird behavior during multiselection.

21 Answers 214 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Raymond
Top achievements
Rank 1
Raymond asked on 12 Nov 2010, 01:21 PM

Hi

                2010 Q2 SP2

                I have grid with 500 rows and enabled multiselection.

I select first row and start multiselection (SHIFT and arrow down buttons). During selecting rows between 1 and 7 or 8 everything is fine (rows are selected – notification by orange background).

When I cross row 7 or 8 my one CPU core jumps to 50% and there is no notification that next rows are selected.

I have to stop multiselection to see orange background for selected rows.

I tested this for bound and unbound mode.

Is there any way to improve performance of this simple functionality?

I am more interested about unbound mode because in ma case I have variable number of columns.


                Here you can read my  simple source code:

 

public class MySample
{
    public string Property1 { get; set; }
    public string Property2 { get; set; }
    public string Property3 { get; set; }
    public string Property4 { get; set; }
    public string Property5 { get; set; }
    public string Property6 { get; set; }
    public string Property7 { get; set; }
    public string Property8 { get; set; }
    public string Property9 { get; set; }
    public string Property10 { get; set; }
}

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Telerik.WinControls.UI;
  
namespace PerformanceIssue
{
    public partial class Form1 : Form
    {
        List<MySample> _list;
        public Form1()
        {
            InitializeComponent();
            _list = this.GenerateList();
        }
  
        private void btnPopulateBound_Click(object sender, EventArgs e)
        {
            radGridViewBound.DataSource = _list;
            foreach (GridViewDataColumn col in radGridViewBound.Columns)
            { col.Width = 100; }
            radGridViewBound.MultiSelect = true;
            radGridViewBound.Columns[0].IsPinned = true;
        }
  
        private void btnPopulateUnbound_Click(object sender, EventArgs e)
        {
            GridViewTextBoxColumn col = null;
            GridViewRowInfo row = null;
  
            for (int index = 1; index <= 10; index++)
            {
                col = new GridViewTextBoxColumn();
                radGridViewUnbound.Columns.Add(col);
                col.Width = 100;
            }
  
            foreach (MySample item in _list)
            {
                row = radGridViewUnbound.Rows.AddNew();
                row.Cells[0].Value = item.Property1;
                row.Cells[1].Value = item.Property2;
                row.Cells[2].Value = item.Property3;
                row.Cells[3].Value = item.Property4;
                row.Cells[4].Value = item.Property5;
                row.Cells[5].Value = item.Property6;
                row.Cells[6].Value = item.Property7;
                row.Cells[7].Value = item.Property8;
                row.Cells[8].Value = item.Property9;
                row.Cells[9].Value = item.Property10;
            }
            radGridViewUnbound.MultiSelect = true;
            radGridViewUnbound.Columns[0].IsPinned = true;
        }
  
        private List<MySample> GenerateList()
        {
            List<MySample> list = new List<MySample>();
            MySample item = null;
            for (int index = 0; index < 500; index++)
            {
                item = new MySample()
                {
                    Property1 = string.Format("Row: {0}, Col: {1}", index, 1),
                    Property2 = string.Format("Row: {0}, Col: {1}", index, 2),
                    Property3 = string.Format("Row: {0}, Col: {1}", index, 3),
                    Property4 = string.Format("Row: {0}, Col: {1}", index, 4),
                    Property5 = string.Format("Row: {0}, Col: {1}", index, 5),
                    Property6 = string.Format("Row: {0}, Col: {1}", index, 6),
                    Property7 = string.Format("Row: {0}, Col: {1}", index, 7),
                    Property8 = string.Format("Row: {0}, Col: {1}", index, 8),
                    Property9 = string.Format("Row: {0}, Col: {1}", index, 9),
                    Property10 = string.Format("Row: {0}, Col: {1}", index, 10)
                };
                list.Add(item);
            }
  
            return list;
        }
    }
}

 

 

 

 

 

Regards

21 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 12 Nov 2010, 03:17 PM
Hello, 

I haven't been able to replicate your issue. The code below runs fine without any highlighting issues. I have only changed the code slightly, as my environment today is VS 2005. The rest is the same. 

For reference, I am using the latest 2010 Q3 version that came out yesterday. 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Telerik.WinControls.UI;
using Telerik.WinControls.Enumerations;
using System.Collections.Generic;
 
namespace RadControlsWinFormsApp1
{
    public partial class Form1 : Form
    {
        List<MySample> _list;
        public Form1()
        {
            InitializeComponent();
            _list = this.GenerateList();
        }
 
        private void Form1_Load(object sender, EventArgs e)
        {
 
        }
 
        private void radButton1_Click(object sender, EventArgs e)
        {
            radGridView1.DataSource = _list;
            foreach (GridViewDataColumn col in radGridView1.Columns)
            { col.Width = 100; }
            radGridView1.MultiSelect = true;
            radGridView1.Columns[0].IsPinned = true;
        }
 
        private List<MySample> GenerateList()
        {
            List<MySample> list = new List<MySample>();
            MySample item = null;
            for (int index = 0; index < 500; index++)
            {
                item = new MySample();
                
                    item.Property1 = string.Format("Row: {0}, Col: {1}", index, 1);
                    item.Property2 = string.Format("Row: {0}, Col: {1}", index, 2);
                    item.Property3 = string.Format("Row: {0}, Col: {1}", index, 3);
                    item.Property4 = string.Format("Row: {0}, Col: {1}", index, 4);
                    item.Property5 = string.Format("Row: {0}, Col: {1}", index, 5);
                    item.Property6 = string.Format("Row: {0}, Col: {1}", index, 6);
                    item.Property7 = string.Format("Row: {0}, Col: {1}", index, 7);
                    item.Property8 = string.Format("Row: {0}, Col: {1}", index, 8);
                    item.Property9 = string.Format("Row: {0}, Col: {1}", index, 9);
                    item.Property10 = string.Format("Row: {0}, Col: {1}", index, 10);
              
                list.Add(item);
            }
   
            return list;
        }
 
        private void radButton2_Click(object sender, EventArgs e)
        {
            GridViewTextBoxColumn col = null;
            GridViewRowInfo row = null;
 
            for (int index = 1; index <= 10; index++)
            {
                col = new GridViewTextBoxColumn();
                radGridView1.Columns.Add(col);
                col.Width = 100;
            }
 
            foreach (MySample item in _list)
            {
                row = radGridView1.Rows.AddNew();
                row.Cells[0].Value = item.Property1;
                row.Cells[1].Value = item.Property2;
                row.Cells[2].Value = item.Property3;
                row.Cells[3].Value = item.Property4;
                row.Cells[4].Value = item.Property5;
                row.Cells[5].Value = item.Property6;
                row.Cells[6].Value = item.Property7;
                row.Cells[7].Value = item.Property8;
                row.Cells[8].Value = item.Property9;
                row.Cells[9].Value = item.Property10;
            }
            radGridView1.MultiSelect = true;
            radGridView1.Columns[0].IsPinned = true;
        }
    }
 
    public class CustomCell : GridDataCellElement
    {
        private RadCheckBoxElement _chk;
        public CustomCell(GridViewColumn column, GridRowElement row)
            : base(column, row)
        {
        }
        protected override void CreateChildElements()
        {
            base.CreateChildElements();
            _chk = new RadCheckBoxElement();
            _chk.Margin = new Padding(2, 2, 2, 2);
            _chk.MinSize = new Size(20, 20);
            _chk.Text = string.Empty;
            _chk.ToggleState = ToggleState.Off;
            this.Children.Add(_chk);
        }
        protected override Type ThemeEffectiveType
        { get { return typeof(GridDataCellElement); } }
    }
 
    public class MySample
    {
        private string m_prop1;
        private string m_prop2;
        private string m_prop3;
        private string m_prop4;
        private string m_prop5;
        private string m_prop6;
        private string m_prop7;
        private string m_prop8;
        private string m_prop9;
        private string m_prop10;
 
        public string Property1
        {
            get
            {return m_prop1;}
            set
            {m_prop1 = value;}
        }
        public string Property2
        {
            get
            { return m_prop2; }
            set
            { m_prop2 = value; }
        }
        public string Property3
        {
            get
            { return m_prop3; }
            set
            { m_prop3 = value; }
        }
        public string Property4
        {
            get
            { return m_prop4; }
            set
            { m_prop4 = value; }
        }
        public string Property5
        {
            get
            { return m_prop5; }
            set
            { m_prop5 = value; }
        }
        public string Property6
        {
            get
            { return m_prop6; }
            set
            { m_prop6 = value; }
        }
        public string Property7
        {
            get
            { return m_prop7; }
            set
            { m_prop7 = value; }
        }
        public string Property8
        {
            get
            { return m_prop8; }
            set
            { m_prop8 = value; }
        }
        public string Property9
        {
            get
            { return m_prop9; }
            set
            { m_prop9 = value; }
        }
        public string Property10
        {
            get
            { return m_prop10; }
            set
            { m_prop10 = value; }
        }
 
    }
}

hope that helps

Richard
0
Raymond
Top achievements
Rank 1
answered on 12 Nov 2010, 03:25 PM
I am downloading 2010 Q3, I will check this on the newest version.
0
Richard Slade
Top achievements
Rank 2
answered on 12 Nov 2010, 03:25 PM
Ok - Let me know how it goes and if you need any other help
Richard
0
Raymond
Top achievements
Rank 1
answered on 13 Nov 2010, 01:57 PM

I have installed 2010 Q3 and I still have the same problem with multiselection.

I press keys SHIFT and arrow down. For about  first 10 rows multiselection is fluent but after about 10 first rows notification of selection (orange background) stops and one core CPU jumps to 100%.

Multiselection is still in progress because when I stop selecting, background color of rows changes to orange.

I have Win XP SP3. I will test this example on Monday on other machines.

Any ideas?

 

Regards

0
Richard Slade
Top achievements
Rank 2
answered on 13 Nov 2010, 02:46 PM
Hi Raymond,

When you press SHIFT and Down Arrow, are you releasing the down arrow for each row and pressing again, or keeping your finger down on the arrow key?

I'm guessing that you are keeping your finger on the down arrow as I can replicate this in this way. I will look into this for you and get back to you as soon as possible

Richard
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 13 Nov 2010, 03:09 PM
Hello again,

I'd say that this is an issue with the grid not refreshing correctly. You can get over this multiselection issue in your grid by registering the SelectionChanged event and adding a RadGridView.Refresh();

this.radGridView1.SelectionChanged += new System.EventHandler(this.radGridView1_SelectionChanged);
  
        private void radGridView1_SelectionChanged(object sender, EventArgs e)
        {
            this.radGridView1.Refresh();
        }


Hpoe this helps, but if you need further help, please let me know

Richard
0
Raymond
Top achievements
Rank 1
answered on 14 Nov 2010, 04:11 PM

Thanks for fast reaction.

Yes – I am keeping my finger on the down arrow.

I used your suggestion to refresh whole grid and it works but selection is slow (because all grid must be refreshed).  I compared this operation (multiselection with keeping finger on the down arrow) with System.Windows.Forms.DataGridView and this grid is faster.

 I tried in Telerik grid not refresh whole grid but only new current row but it does not work – there is no notification that rows are being selected by orange background.

 

private void radGridViewUnbound_SelectionChanged(object sender, EventArgs e)
{
    radGridViewUnbound.CurrentRow.InvalidateRow();
}



I think you have something not optimized in your code or maybe there is some new method that I should call before continuous multiselection?

 

 

Regards

 

 

 

 

0
Richard Slade
Top achievements
Rank 2
answered on 14 Nov 2010, 06:11 PM
Hi Raymond,

I'm glad that worked for you as a workaround. I don't work for Telerik, but I will continue to look into this to see if there is a better workaround to this.

All the best
Richard
0
Raymond
Top achievements
Rank 1
answered on 15 Nov 2010, 09:42 AM
I reported this as bug.
Bug Report ID:366647 -- Performance issue with multiselection
0
Alexander
Telerik team
answered on 17 Nov 2010, 06:42 PM
Hello Raymond,

Thank you for your report.

We will try to improve the RadGridView performance in the row multiselection scenario in a future version.

Best regards,
Alexander
the Telerik team
See What's New in RadControls for WinForms in Q3 2010 on Wednesday, November 17, 11am Eastern Time: Register here>>
0
Raymond
Top achievements
Rank 1
answered on 06 Dec 2010, 10:59 AM

Hi!

Will you fix this issue in Q3 SP1?

I have checked PITS and status is open (so I assume that you even did not start).

 

It is really important for me because this simply functionality works fine in standard .net grid so I cannot deliver something that has broken this functionality.

Also this issue http://www.telerik.com/community/forums/winforms/gridview/performance-issue-with-custom-cells.aspx    (bug id: 366641 ) is very important to me and it is also open in PITS.

Regards

0
Richard Slade
Top achievements
Rank 2
answered on 06 Dec 2010, 11:16 AM
Hi Raymond,

Whilst I can't influence what will be in the release, I'd advise going into the issue in PITS and voting for it if you haven't already as this will be sure to help get the issue fixed sooner.

All the best
Richard
0
Alexander
Telerik team
answered on 09 Dec 2010, 03:13 PM
Hello Raymond,

We are working on improving the performance of RadGridView in both cases reported by you - using multi-selection and scrolling. We will try to include the updates in the upcoming service pack.

Best regards,
Alexander
the Telerik team
Get started with RadControls for WinForms with numerous videos and detailed documentation.
0
Raymond
Top achievements
Rank 1
answered on 09 Dec 2010, 04:01 PM

Thanks for answer.

I hope that it will be included in service pack – if not I will have to switch to standard .NET grid because I have a lot of rows in my grid and with this slow performance user experience is really bad.

Good luck!

Regards
0
Raymond
Top achievements
Rank 1
answered on 15 Dec 2010, 02:06 PM

I see that you resolved both issue with performance in grid (366804 and 366647).

I am very glad.

When do you plan release SP1? Can I get some internal build with this fix to check if your change satisfies my needs?

Ragards

 

0
Richard Slade
Top achievements
Rank 2
answered on 15 Dec 2010, 02:10 PM
Hi Raymond,

I understand the Q3 2010 SP1 Release is due for this week. (mid-December)
Richard
0
Raymond
Top achievements
Rank 1
answered on 15 Dec 2010, 02:15 PM
ok
0
Alexander
Telerik team
answered on 15 Dec 2010, 03:21 PM
Hello Raymond,

Please feel free to test the multi-selection and scrolling performance of RadGridView when the service pack is released. We will be happy to hear your feedback concerning the new release.

Best regards,
Alexander
the Telerik team
Get started with RadControls for WinForms with numerous videos and detailed documentation.
0
Raymond
Top achievements
Rank 1
answered on 17 Dec 2010, 10:17 AM

I tested grid on SP1 and for sure it is faster than it was – thank you for this fix but scrolling still eats too much CPU.

If I do scrolling by keeping pressed arrow down button in standard .NET grid CPU usage is all the time almost 0%.

If do scrolling in the same way in Telerik grid after while (you will see this problem when hidden rows – that are outside of grid – becomes visible) CPU usage is almost 100% - so you still have something that is not optimized correctly.

You can see this problem in sample project added to bug number 366641 (maximize window for whole screen).

Do you plan investigate this issue to decrease CPU usage during scrolling?

Regards

0
Raymond
Top achievements
Rank 1
answered on 17 Dec 2010, 10:46 AM

I found also another issue: when I do scrolling whole grid a little shivers.

0
Jack
Telerik team
answered on 22 Dec 2010, 02:40 PM
Hello Raymond,

Thank you for your feedback and for this additional information. Yes, we plan to investigate why the grid is slower when there are hidden rows and if there is an issue, we will address it in our upcoming release.

We constantly try to optimize the performance of our controls and take seriously every issue reported by our customers. However, our grid control will never be fast like the standard MS DataGridView control. This is because of the additional features and visual effects that we offer. Nevertheless, we will continue our efforts to make the RadGridView control faster.

I hope this helps. If you have any further questions, do not hesitate to ask.

Kind regards, Jack
the Telerik team
Check out the Q1 2011 Roadmap for Telerik Controls for Windows Forms.
Tags
GridView
Asked by
Raymond
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Raymond
Top achievements
Rank 1
Alexander
Telerik team
Jack
Telerik team
Share this question
or