正太养成指南,568网址导航,日冠王
在使用 devexpress 的 gridcontrol 为其实现 checkbox 列,发现如果勾选了三行的数据,在遍历 gridcontrol 绑定的数据源时 checkbox 列的数据仅有 2 行被更新。
使用 google 搜索了半天,在 devexpress 的 support 上找到了答案,似乎是需要手动调用 gridcontrol 关联 view 的 posteditor()
方法。
在这里我使用的是 gridcontrol 的 bandedgridview 视图,所以在获取数据源的时候,手动调用一下视图的 posteditor()
即可。
private void buttona_click(object sender,eventargs e) { bandedgridview1.posteditor(); if(griccontrol1.datasource is bindinglist<itemdto> items) { var checkeditems = item.where(x=>x.isupdate); } }
关于 posteditor()
方法的解释:
posts the value to the associated data source but doesn't close the active in-place editor.
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Blazor server side 自家的一些开源的, 实用型项目的进度之 CEF客户端
.NET IoC模式依赖反转(DIP)、控制反转(Ioc)、依赖注入(DI)
vue+.netcore可支持业务代码扩展的开发框架 VOL.Vue 2.0版本发布
网友评论