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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM