如何禁用'新项目行' Devexpress网格中的区域

时间:2016-05-02 14:33:56

标签: vb.net gridview devexpress

我在Devexpress中有一个gridview。在网格的顶部,我有一个空白 允许我向网格添加新客户端的区域。问题是 当我点击右栏附近的空白区域时,它就好像我一样 点击了' Supprimer'按钮。我想禁用那个正确的区域,这样当我点击它时,没有任何反应。所以这意味着,如果我点击空白区域的左侧,我只能添加一个新客户端。

我曾试图玩过ShowsEditor,但无法让它工作:

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

enter image description here

1 个答案:

答案 0 :(得分:0)

使用此:

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
相关问题