简体   繁体   中英

How to disable 'new item row' area in Devexpress grid

I have a gridview in Devexpress. At the top of the grid, I have a blank area that allows me to add a new client to the grid. The problem is that when I click on the blank area near the right column, it's as if I had clicked on the 'Supprimer' button. I would like to disable that right area so that when I click on it, nothing happens. So this means, I could only add a new client if I click on the left side of the blank area.

I've tried to play around with the ShowingEditor but could not get it to work:

Private Sub gvException_ShowingEditor(sender As Object, e As CancelEventArgs) Handles gvException.ShowingEditor

        If gvException.IsNewItemRow(gvException.FocusedRowHandle) Then
            gvException.Columns("Supprimer").OptionsColumn.ReadOnly = True
            buttonDeleteException.Buttons(0).Caption = "Supprimer"
            'e.Cancel = True
        Else
            gvException.Columns("Supprimer").OptionsColumn.ReadOnly = False
            e.Cancel = False
        End If
    End Sub

在此处输入图片说明

Use this :

Private Sub gvException_ShowingEditor(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles gvException.ShowingEditor
    If gvException.IsNewItemRow(gvException.FocusedRowHandle) and gvException.FocusedColumn.FieldName = "Supprimer" Then
        e.Cancel = True
    End If
End Sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM