Completed
Last Updated: 15 May 2024 07:49 by ADMIN
Release 2024.2.514 (2024 Q2)
Shishir
Created on: 14 Mar 2024 11:51
Category: GridView
Type: Bug Report
1
RadGridView: NullReferenceException occurs in multi select scenario, when clicking on an empty area and the mouse leaves the grid
NullReferenceException occurs in a multi-select scenario when clicking (and holding the mouse button) on an empty area in the grid and the mouse leaves the boundaries of the control.
1 comment
ADMIN
Dinko | Tech Support Engineer
Posted on: 14 Mar 2024 12:24

Hi Shishir,

Thank you for reporting this.

You can try to workaround this by creating a custom grid data row behavior:

BaseGridBehavior behavior = (BaseGridBehavior)this.radGridView2.GridBehavior;
behavior.UnregisterBehavior(typeof(GridViewDataRowInfo));
behavior.RegisterBehavior(typeof(GridViewDataRowInfo), new MyGridRowBehavior());

public class MyGridRowBehavior : GridDataRowBehavior
{
    public override bool OnMouseDown(MouseEventArgs e)
    {
        typeof(GridRowBehavior).GetField("orderedRows", System.Reflection.BindingFlags.NonPublic |
                                                        System.Reflection.BindingFlags.Instance).SetValue(this, new List<GridViewRowInfo>());
        bool result = base.OnMouseDown(e);

        return result;
    }
}

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.