This is a migrated thread and some comments may be shown as answers.

Problem with validation and scrolling in GridView

2 Answers 105 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Steve Newbery
Top achievements
Rank 2
Steve Newbery asked on 07 Dec 2012, 08:00 PM
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 Answers, 1 is accepted

Sort by
0
Steve Newbery
Top achievements
Rank 2
answered on 09 Dec 2012, 11:06 AM
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 !
0
Svett
Telerik team
answered on 12 Dec 2012, 05:20 PM
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.
Tags
GridView
Asked by
Steve Newbery
Top achievements
Rank 2
Answers by
Steve Newbery
Top achievements
Rank 2
Svett
Telerik team
Share this question
or