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

SelectionChanged event not working well

3 Answers 244 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Paul Somberg
Top achievements
Rank 2
Paul Somberg asked on 20 Sep 2012, 02:27 PM
Hello,

I have a RadGridView with an handler for the SelectionChanged event. MultiSelect is enabled. If I hold the mouse button and move the mouse to select rows, the event is triggered as expected. However, if I keep holding the mouse button and move the mouse back to select less rows, the event is not triggered! It seems to me that this is an error in the RadGridView.

I use this functionality to update a label with the number of selected rows, which is not updated correctly this way. Is there a way that I could make this work?

Below is a code snippet that shows my problem.

int previousSelectedItemCount;
        private void rgvObjecten_SelectionChanged(object sender, EventArgs e)
        {
            if (previousSelectedItemCount > rgvObjecten.SelectedRows.Count)
            {
// this is not reached
            }
            previousSelectedItemCount = rgvObjecten.SelectedRows.Count;
 // code to update label here
}

3 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 21 Sep 2012, 01:24 PM
Hi Paul,

Thank you for bringing this issue to our attention.

I logged it in our issue tracking system and I updated your Telerik points accordingly. Due to the nature of the issue I am not able to provide you with a suitable work around. We will try to address the issue in one of our upcoming releases. You can track the issue status by following this link.

Should you have other questions, do not hesitate to ask.
 
Regards,
Jack
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Regis
Top achievements
Rank 1
answered on 25 Nov 2013, 07:28 PM
I’m glad to see I’m not the only one with this issue.  I’d tried SelectionChanged and SelectionChanging and neither responded when rows were being deselected by the mouse.  I finally gave up on the ideal of having the program respond in “realtime as the selected rows collection was modified and moved my code into the MouseUp event of the gridview:
private void radGridView_MouseUp(object sender, MouseEventArgs e)
{
 
if (e.Button == MouseButtons.Left)
 {
    if(radGridView.SelectedRows.Count >0 && radGridView.SelectedRows[0].DataBoundItem is MyObject)
       
for (int i = 0; i < radGridView.SelectedRows.Count; i++)
          {
           MyObject obj =    (MyObject)radGridView.SelectedRows[i].DataBoundItem);                         
         
//Do stuff with obj
           }
   }
}

Any update on when this fix is coming or a better work around?

0
George
Telerik team
answered on 28 Nov 2013, 06:08 PM
Hello Regis,

Thank you for contacting us.

The issue you are describing has been resolved and the fix was released in version 2013 Q1. If you want to benefit from this fix and many others you should either update to at least version 2013 Q1 or to the latest - 2013 Q3 SP1.

Let me know if you have any other questions.

Regards,
George
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Paul Somberg
Top achievements
Rank 2
Answers by
Jack
Telerik team
Regis
Top achievements
Rank 1
George
Telerik team
Share this question
or