dev gridcontrol设置复选框列,和按数据选择行

OptionsSelection->MultiSelect=true

OptionsSelection->MultiSelectMode=CheckBoxRowSelect

获取选择行

 var roles = gridView1.GetSelectedRows().Select(index => gridView1.GetRow(index) as op_role).ToList();

按数据选择行

private void RefreshSelectRows(List<op_user_role> RoleInfos)
        {
            gridView1.ClearSelection();
            //排序后的数据集合
            var data = gridView1.DataController.GetAllFilteredAndSortedRows() as BindingList<op_role>;
            if (data == null)
                data = DataRole;
            for (int row = 0; row < data.Count; row++)
            {
                if (RoleInfos.Where(it => it.rid == data[row].id).Count() > 0)
                {
                    gridView1.SelectRow(row);
                }
            }
        }

 

posted @ 2020-10-06 10:10  世人皆萌  阅读(973)  评论(0编辑  收藏  举报