Problem with validation and scrolling in GridView

3 posts, 0 answers
  1. Steve Newbery
    Steve Newbery avatar
    2 posts
    Member since:
    Oct 2012

    Posted 07 Dec 2012 Link to this post

    We have found a serious bug in RadGridView for WinForms, whereby the user can become completely "trapped" in the application when entering an invalid value in a cell, then scrolling the grid.

    You can reproduce the behaviour using the Winforms demo application: Demo Application - RadControls for WinForms Q3 2012:

    1. Enter an invalid value in a cell, and press enter.
    2. Scroll the grid, by clicking in the scroll bar.
    3. Now you're stuck, if you scroll back the entered value is gone, but the row is still in error.

    You are truly stuck, you can't clear the original error. The only way out I found is to force quit the demo application via the Task Manager.

    By the way, don't click the down scroll box (I mean the little triangle at the bottom of the scroll bar) or the app will start scrolling endlessly and eventually crash.

    So, how to work around this? One suggestion is to override the CloseEditor :

    Public Class MyGridViewEditManager
        Inherits GridViewEditManager
        Public Sub New(ByVal gridView As RadGridViewElement)
            MyBase.New(gridView)
        End Sub
     
        Public Overrides Function CloseEditor() As Boolean
            Dim closeOnFail As Boolean = Me.CloseEditorWhenValidationFails
            Me.CloseEditorWhenValidationFails = True
            Dim result As Boolean = MyBase.CloseEditor()
            Me.CloseEditorWhenValidationFails = closeOnFail
            Return result
        End Function
    End Class

    and then in the New() of the form (where MyGridView is the name of my grid):

    Me.MyGridView.GridViewElement.EditorManager = New MyGridViewEditManager(Me.MyGridView.GridViewElement)

    This kind of works, but it always closes the editor whenever the user clicks anywhere outside the invalid cell. It avoids the problem of being trapped, but the behaviour is strange - you wouldn't expect the invalid value to disappear when you click outside the cell. The desired behaviour is that the editor is closed if the user scrolls.

    One approach I tried without success is to disable scrolling while a grid cell is in edit mode, but no luck.

    Does anyone have a good workaround for this tricky problem?
  2. Steve Newbery
    Steve Newbery avatar
    2 posts
    Member since:
    Oct 2012

    Posted 09 Dec 2012 Link to this post

    Ok - I have a good workaround, which is just to hide the scroll bars when the user types in a cell, ie in the ValueChanging event

    Me.MyGridView.VerticalScrollState = ScrollState.AlwaysHide

    Then in the CellValidated event i just reset the scrollstate to AutoHide again.

    This works fine !
  3. Svett
    Admin
    Svett avatar
    728 posts

    Posted 12 Dec 2012 Link to this post

    Hello Steve,

    You can find our reply in your support thread 631377.

    Let us know if you have questions or comments.

    Regards,
    Svett
    the Telerik team
    Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
Back to Top