Declined
Last Updated: 17 Aug 2020 14:27 by ADMIN
dev
Created on: 07 Aug 2020 14:57
Category: GridView
Type: Bug Report
0
RadGridView: Exit edit Mode when GridView loses focus

Hi,

I have a question regarding RadGridView. When I edit a cell in GridView and then click on a button (outside of gridview) immediately (i.e I don't click on another cell to exit edit mode), the Gridview is still edit mode. Please refer to the short video named "Without Using EndEdit()" to easily understand my point here.

In order to exit the edit mode, I try the following code:

    Private Sub CustomGridView_LostFocus(sender As Object, e As EventArgs) Handles Me.LostFocus
        Me.EndEdit()
    End Sub

With this code, the gridview does exit the edit mode when I click on another button. But there is a problem with this method is that afterwards, I cannot edit the cell anymore.  Please refer to the short video named "Using EndEdit()" to better understand the problem.

So my question here is, is there any way that I can exit edit mode when clicking on another button right after editing a cell?

Thank you for your help.

Best regards,

Tran

 

 
2 comments
ADMIN
Dimitar
Posted on: 17 Aug 2020 14:27

By default EndEdit is fired from the Validation event. RadRibbonBar doesn't cause validation by default and you can change this behavior by manually setting radRibbonBar.CausesValidation to true

For reference: the MS DataGridView behaves the same way. 

ADMIN
Dess | Tech Support Engineer, Sr.
Posted on: 10 Aug 2020 05:11
Hello, Tran,

Indeed, the illustrated behavior doesn't seem to be correct. I would like to note that the RadGridView.LostFocus event is also fired when the editor is activated since it gains the focus. Hence, it is not the appropriate place for calling EndEdit. Following the provided information, I was able to observe identical behavior on my end. Please refer to the attached gif file.

I have logged it in our feedback portal by creating a public thread on your behalf. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

I have also updated your Telerik points.

Currently, the possible solution that I can suggest is to call the EndEdit method in the Click event of the RadButtonElement in the ribbon: 

    Private Sub RadButtonElement1_Click(sender As Object, e As EventArgs)
        Me.RadGridView1.EndEdit()
    End Sub

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik