C# – devexpress row deleting event

asp.netaspxgridviewcdevexpress

Deletebutton doesn't raise OnRowDeleting event

i created devexpress gridview on runtime it s working good until click the delete button ,when i click it ,it doesn't work .on debug it doesnt fire "rowdeleting". What can i do?

    dovizgrd.Width = Unit.Percentage(50);
    dovizgrd.EnableCallBacks = false;
    dovizgrd.Settings.ShowFooter = false;
    dovizgrd.Settings.ShowColumnHeaders = false;
    dovizgrd.Settings.ShowFilterBar = GridViewStatusBarMode.Hidden;
    dovizgrd.SettingsPager.Visible = true;
    dovizgrd.SettingsPager.Mode = GridViewPagerMode.ShowPager;
    dovizgrd.Styles.Header.Wrap = DevExpress.Utils.DefaultBoolean.True;
    dovizgrd.SettingsPager.PageSize = 10;

    DevExpress.Web.ASPxGridView.GridViewCommandColumn col0 =
    new  DevExpress.Web.ASPxGridView.GridViewCommandColumn();
    col0.ShowSelectCheckbox = true;
    col0.Caption = " ";
    col0.Width = Unit.Pixel(30);
    col0.VisibleIndex = 0;

    DevExpress.Web.ASPxGridView.GridViewDataTextColumn col1 =new DevExpress.Web.ASPxGridView.GridViewDataTextColumn();
                col1.FieldName = "example1";
                col1.Visible = false;
                col1.VisibleIndex = 1;

    DevExpress.Web.ASPxGridView.GridViewDataTextColumn col2 = 
    new DevExpress.Web.ASPxGridView.GridViewDataTextColumn();
                col2.FieldName = "example2";
                col2.Visible = false;
                col2.VisibleIndex = 2;

                DevExpress.Web.ASPxGridView.GridViewDataTextColumn col3 = new DevExpress.Web.ASPxGridView.GridViewDataTextColumn();
                col3.FieldName = "example3";
                col3.Caption = "Döviz Çeşidi";
                col3.Width = Unit.Pixel(100);
                col3.VisibleIndex = 3;

                DevExpress.Web.ASPxGridView.GridViewCommandColumn col4 = new DevExpress.Web.ASPxGridView.GridViewCommandColumn();
                col4.Caption = " ";
                //col4.EditButton.Visible = false;
                col4.DeleteButton.Visible = true;
                //col4.NewButton.Visible = false;
                col4.ButtonType = ButtonType.Image;

                col4.DeleteButton.Image.Url = "~/Images/icons/delete.gif";

                col4.Width = Unit.Pixel(35);
                col4.VisibleIndex = 4;

                dovizgrd.Columns.Add(col0);
                dovizgrd.Columns.Add(col1);
                dovizgrd.Columns.Add(col2);
                dovizgrd.Columns.Add(col3);
                dovizgrd.Columns.Add(col4);
                grdPH.Controls.Add(dovizgrd);
                dovizgrd.DataBind();

                dovizgrd.RowDeleting += new      DevExpress.Web.Data.ASPxDataDeletingEventHandler(grd_RowDeleting);

Best Answer

You haven't posted complete code but it seems to me that you haven't set KeyFieldName on your ASPxGridView.

Documentation states:

If the KeyFieldName property isn't specified, the following operations are not allowed:
- data editing
- adding new and deleting existing rows
- selecting rows

Related Topic