DevExpress gridcontrol添加了复选框删除选中的多行/批量删除的方法

思路:遍历gridView1的每一行,该行中checkbox列被勾选则设置该行为选中状态,执行gridView1提供的DeleteSelectedRows方法则可

public void DoDelete()

        {

           

            for (int i = 0; i < gridView1.DataRowCount; i++)

            {

               if (gridView1.GetDataRow(i)["checked"].ToString().Trim().ToLower() == "true")

                {

                    gridView1.SelectRow(i);

                }

                else 

                {

                    gridView1.UnselectRow(i);

                    continue; 

                }

                               

            }



            this.gridView1.DeleteSelectedRows(); 



            gridView1.RefreshData();

        }   

 

你可能感兴趣的:(DevExpress)