Esempio n. 1
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            var rows = this.gridView1.GetSelectedRows();

            if (rows.Length == 0)
            {
                Msg.Warning("请选择需要删除的数据行");
            }
            else
            {
                // var model = (Products)gridView1.GetFocusedRow();
                if (Msg.AskQuestion("确定删除?"))
                {
                    int    selRow = gridView1.FocusedRowHandle;
                    string Id     = gridView1.GetRowCellValue(selRow, "productId").ToString();
                    var    ret    = _productApp.DelById(Id.ToInt());
                    if (ret)
                    {
                        Msg.ShowInformation("删除成功");
                        //GridView view = sender as GridView;
                        //view.DeleteRow(view.FocusedRowHandle);

                        gridView1.DeleteRow(selRow);
                    }
                    else
                    {
                        Msg.ShowError("删除失败");
                    }
                }
            }
        }