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); } } }