标签:efault ISE gnu tostring column head boolean image view
C# 使用Dev控件为gridView添加复选框,实现多选和单选,代码如下:
1 this.gridControl1.DataSource = dtss; 2 gridView1.OptionsSelection.MultiSelect = true; 3 4 gridView1.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.CheckBoxRowSelect; 5 6 gridView1.OptionsSelection.ShowCheckBoxSelectorInColumnHeader = DevExpress.Utils.DefaultBoolean.True;
如图所示样式:
获取选中的数据:
1 for (int i = 0; i < this.gridView1.RowCount; i++) 2 { 3 4 if (this.gridView1.IsRowSelected(i)) 5 { 6 ZYDModel mo = new ZYDModel(); 7 mo.JH = this.gridView1.GetDataRow(i)["标题1"].ToString(); 8 mo.RQ = this.gridView1.GetDataRow(i)["标题2"].ToString(); 9 mo.YGNUM = this.gridView1.GetDataRow(i)["标题3"].ToString(); 10 mo.CYGNUM = this.gridView1.GetDataRow(i)["标题4"].ToString(); 11 mo.ZYD = this.gridView1.GetDataRow(i)["标题5"].ToString(); 12 }
C# 使用Dev控件为gridView添加复选框,实现多选和单选
标签:efault ISE gnu tostring column head boolean image view
原文地址:https://www.cnblogs.com/xiong950413/p/13045305.html