文章来源 csdn weinierbian http://blog.csdn.net/weinierbian/article/details/6255402
添加一列,FieldName为 "check",将ColumnEdit 设置为 复选框 样式。gridview1editable设置为true
将要绑定的DataTable添加列 "check",Type 为 bool。
绑定DataTable到GridControl。
获取: string value = gridview.GetDataRow(i)["check"].toString();
value == "true" || "" ("false")
设置为多选
gridView1.OptionsSelection.MultiSelect = true;
gridView1.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.RowSelect;
测试的例子如下:
给gridcontrol添加数据
[c-sharp] view plaincopy
点击测试check按钮响应如下事件(获取被check的数据)
[c-sharp] view plaincopy
运行结果如下:
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有