我在运行时创建了一个gridview,但我没有创建命令按钮事件。我的问题与devexpress 行删除事件非常相似,但我没有解决它:/ 这是我的代码:
在我的 Page_Load 函数中:
ASPxGridView grid = new ASPxGridView();
grid.ID = "ASPxGridView1";
Page.Form.Controls.Add(grid);
GridViewCommandColumn cIslem = new GridViewCommandColumn("İşlem");
cIslem.EditButton.Visible = true;
cIslem.DeleteButton.Visible = true;
cIslem.NewButton.Visible = true;
grid.Columns.Add(cIslem);
GridViewDataTextColumn cID = new GridViewDataTextColumn();
cID.Name = "ID";
cID.Caption = "ID";
cID.FieldName = "ID";
cID.ReadOnly = true;
cID.Visible = false;
grid.Columns.Add(cID);
GridViewDataTextColumn cName = new GridViewDataTextColumn();
cName.Name = "Name";
cName.Caption = "Name";
cName.FieldName = "Name";
cName.ReadOnly = true;
cName.CellStyle.HorizontalAlign = HorizontalAlign.Center;
grid.Columns.Add(cName);
grid.SettingsBehavior.AllowFocusedRow = true;
grid.KeyFieldName = "ID";
DataTable dt = new DataTable("Veri");
dt.Columns.Add("ID");
dt.Columns.Add("Name");
DataRow dr = dt.NewRow();
dr["Name"] = "ABC";
dr["ID"] = "1";
dt.Rows.Add(dr);
grid.DataSource = dt;
grid.DataBind();
grid.RowDeleting += new DevExpress.Web.Data.ASPxDataDeletingEventHandler(grd_RowDeleting);
当我单击删除按钮时,我给出了错误:
“找不到回调的目标 'ASPxGridView1' 或未实现 ICallbackEventHandler”
我该如何解决?