RadGridView filter crashes due to multi select and fast clicking

2 posts, 0 answers
  1. Nathan
    Nathan avatar
    3 posts
    Member since:
    Jun 2015

    Posted 02 Jul 2015 Link to this post

    I am having an issue with the filter option crashing with radgridview.

    To reproduce, create a radgridview as I describe below.

    Run the program

    Quickly click around in the cells of the table a few times, making sure to drag your mouse a bit so to select a few rows on some of the clicks.

    Then quickly click the filter. (sometimes takes a few tries)

    I get the following error


    System.NullReferenceException: Object reference not set to an instance of an object. 

       at Telerik.WinControls.UI.GridRowBehavior.DoMultiFullRowSelect(GridCellElement currentCell, Point currentLocation)
       at Telerik.WinControls.UI.GridRowBehavior.DoMouseSelection(GridCellElement currentCell, Point currentLocation)
       at Telerik.WinControls.UI.GridRowBehavior.ProcessMouseSelection(Point mousePosition, GridCellElement currentCell)
       at Telerik.WinControls.UI.GridRowBehavior.OnMouseMove(MouseEventArgs e)
       at Telerik.WinControls.UI.BaseGridBehavior.OnMouseMove(MouseEventArgs e)
       at Telerik.WinControls.UI.RadGridView.OnMouseMove(MouseEventArgs e)
       at System.Windows.Forms.Control.WmMouseMove(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at Telerik.WinControls.RadControl.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at BeaconQuerySource.Program.Main(String[] args)


    To create the grid do the following.

     Make a RadGridView with the following options (not sure if all are important but the filter and multiselect are) 

    this.gridConnectedSessions.MasterTemplate.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill;

    this.gridConnectedSessions.MasterTemplate.EnableAlternatingRowColor = true;
    this.gridConnectedSessions.MasterTemplate.EnableFiltering = true;

    this.gridConnectedSessions.MasterTemplate.MultiSelect = true;

    (leave the rest as the default options)

    Add 3 columns to the grid

    Add 5 rows of data to the grid (I used the following)

    radGridView1.Rows.Add("test2", "test2", "test2");
    radGridView1.Rows.Add("test3", "test3", "test3");
    radGridView1.Rows.Add("test4", "test4", "test4");
    radGridView1.Rows.Add("test5", "test5", "test5");


    Any help would be appreciated, thank you.

  2. Dess
    Dess avatar
    1562 posts

    Posted 06 Jul 2015 Link to this post

    Hello Nathan,

    Thank you for writing.

    Following the provided information I have prepared a sample project and successfully reproduced the NullReferenceException. I have logged it in our feedback portal. You can track its progress, subscribe for status changes and add your vote/comment to it on the following link - feedback item.

    I have also updated your Telerik points.

    Currently, the possible solution that I can suggest is to use a custom filter row behavior:
    public Form1()
        this.radGridView1.MasterTemplate.AutoSizeColumnsMode = Telerik.WinControls.UI.GridViewAutoSizeColumnsMode.Fill;
        this.radGridView1.MasterTemplate.EnableAlternatingRowColor = true;
        this.radGridView1.MasterTemplate.EnableFiltering = true;
        this.radGridView1.MasterTemplate.MultiSelect = true;
        for (int i = 0; i < 3; i++)
            this.radGridView1.Columns.Add("Col" + i);
        radGridView1.Rows.Add("test1", "test1", "test1");
        radGridView1.Rows.Add("test2", "test2", "test2");
        radGridView1.Rows.Add("test3", "test3", "test3");
        radGridView1.Rows.Add("test4", "test4", "test4");
        radGridView1.Rows.Add("test5", "test5", "test5");
        BaseGridBehavior gridBehavior = radGridView1.GridBehavior as BaseGridBehavior;
        gridBehavior.RegisterBehavior(typeof(GridViewFilteringRowInfo), new CustomGridFilterRowBehavior());
    public class CustomGridFilterRowBehavior : GridFilterRowBehavior
        protected override bool ProcessMouseSelection(Point mousePosition, GridCellElement currentCell)
            return false;

    I hope this information helps. Should you have further questions, I would be glad to help.
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft R3 2016 release webinar banner
Back to Top