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();
}
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.
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