Unplanned
Last Updated: 10 Feb 2025 13:40 by ADMIN
Dietmar Hasse
Created on: 10 Feb 2025 13:26
Category: GridView
Type: Bug Report
0
RadGridView: NullReferenceException is thrown when in multi-select scenario while you have MergedCells
In this scenario, the MultiSelect option of the control is enabled. If we click and hold the mouse to select multiple cells and go over a merged cell, NullReferenceException is thrown.
1 comment
ADMIN
Dinko | Tech Support Engineer
Posted on: 10 Feb 2025 13:40

Hello Dietmar Hasse,

Thank you for reporting this exception.

As a workaround, we can manually handle the exception. We can create a custom BaseGridBehavior and override the default behavior of the RadGridView. In the custom class, we can override the GetRowBehaviorAtPoint() and return Null in some scenarios instead of executing the base code.

Public Class CustomGridBehavior
    Inherits BaseGridBehavior

    Protected Overrides Function GetRowBehaviorAtPoint(point As Point) As IGridBehavior

        Dim cellAtPoint = Me.GridViewElement.GridControl.ElementTree.GetElementAtPoint(Of GridCellElement)(point)

        If TypeOf cellAtPoint Is GridMergeCellElement AndAlso ((Control.ModifierKeys And Keys.Shift) = Keys.Shift Or (Control.ModifierKeys And Keys.Control) = Keys.Control Or (Control.MouseButtons And MouseButtons.Left) = MouseButtons.Left) Then
            Return Nothing
        End If

        Return MyBase.GetRowBehaviorAtPoint(point)
    End Function
End Class

 RadGridView1.GridBehavior = New CustomGridBehavior()

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.