SelectionChanged event not working well

4 posts, 0 answers
  1. Paul Somberg
    Paul Somberg avatar
    9 posts
    Member since:
    Feb 2009

    Posted 20 Sep 2012 Link to this post

    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
    }
  2. Jack
    Admin
    Jack avatar
    2335 posts

    Posted 21 Sep 2012 Link to this post

    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 >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Regis
    Regis avatar
    3 posts
    Member since:
    Jul 2013

    Posted 25 Nov 2013 Link to this post

    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?

  5. George
    Admin
    George avatar
    500 posts

    Posted 28 Nov 2013 Link to this post

    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 >>
Back to Top