0

i have this code that add column and button to gridControl

private void btnDown_Click(object sender, EventArgs e)
{
    DataRow r = dt.NewRow();

    r[0] = cmbProject.Text;
    r[1] = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "Le Nom").ToString();
    r[2] = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "Quantité Restante");
    r[3] = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "Longueur");

    dt.Rows.Add(r);

    deleteButton = new RepositoryItemButtonEdit();
   deleteButton.Buttons[0].Kind = ButtonPredefines.Delete;
    GridColumn column = gridView2.Columns["Projet"];
    column.ColumnEdit = deleteButton;
    column.ShowButtonMode = ShowButtonModeEnum.ShowAlways;
    deleteButton.ButtonClick += btnDelete_Click;
}

and this is my code of button btnDelete

private void btnDelete_Click(object sender, EventArgs e)
{
    gridView2.DeleteSelectedRows();
}

screenshot

all code working fine but i cannot make the deleteButton remove the selected row in gridview,Can anyone help me, i am using DevExpress WinForms GridControl.

M.Bouabdallah
  • 530
  • 10
  • 29

1 Answers1

0

I suggest you to go through following references:
DevExpress XtraGrid RepositoryItemButtonEdit event is not firing

Please check whether you set the this.gridView1.OptionsBehavior.Editable property to false. So, in-place editors are not activated and, therefore, their events are not fired.

References:
Repository Button Column Events Not Firing
Repository ButtonEdit Click Event only fires on first click

Niranjan Singh
  • 18,017
  • 2
  • 42
  • 75
  • thanks for your help ,i add this code gridView2.Columns["Projet"].OptionsColumn.AllowEdit = true;after that i add this code deleteButton.TextEditStyle = TextEditStyles.DisableTextEditor – M.Bouabdallah May 11 '18 at 20:29