惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

A
Arctic Wolf
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Google Online Security Blog
Google Online Security Blog
Help Net Security
Help Net Security
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
T
The Exploit Database - CXSecurity.com
Application and Cybersecurity Blog
Application and Cybersecurity Blog
S
Security Affairs
N
News and Events Feed by Topic
Forbes - Security
Forbes - Security
月光博客
月光博客
博客园 - Franky
The GitHub Blog
The GitHub Blog
O
OpenAI News
The Cloudflare Blog
Google DeepMind News
Google DeepMind News
P
Privacy & Cybersecurity Law Blog
WordPress大学
WordPress大学
H
Help Net Security
Apple Machine Learning Research
Apple Machine Learning Research
V
Visual Studio Blog
爱范儿
爱范儿
S
Secure Thoughts
T
The Blog of Author Tim Ferriss
SecWiki News
SecWiki News
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
J
Java Code Geeks
阮一峰的网络日志
阮一峰的网络日志
宝玉的分享
宝玉的分享
博客园_首页
Cisco Talos Blog
Cisco Talos Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
C
Cisco Blogs
博客园 - 三生石上(FineUI控件)
Hacker News: Ask HN
Hacker News: Ask HN
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
人人都是产品经理
人人都是产品经理
腾讯CDC
Know Your Adversary
Know Your Adversary
P
Proofpoint News Feed
云风的 BLOG
云风的 BLOG
The Last Watchdog
The Last Watchdog
博客园 - 叶小钗
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Hugging Face - Blog
Hugging Face - Blog
PCI Perspectives
PCI Perspectives
罗磊的独立博客
有赞技术团队
有赞技术团队
B
Blog RSS Feed
L
LINUX DO - 最新话题

博客园 - chengbo

Android Studio:为Android定制的IDE 使用Gitolite来对Git的repository实现权限控制 用Debian当路由,来解决BT造成的网络慢的问题 更快的,更好的支持硬件的模拟器 当LISTVIEW有HEADER时,ONITEMCLICK里的POSITION不正确 准备再写写东西了 压缩 ViewState 后,与 UpdatePanel 的兼容问题 - chengbo 如何让 firefox 的窗口大小不再被网页脚本改变 52个行之有效的减压方法 用Javascript检查Caps Lock是否按下 如何用C#和SQL获得当前月的第一天和最后一天 每天如何自动编译项目并将之打包添加到VSS中 - chengbo - 博客园 maxthon 2 预览版的邀请 成都古羌科技有限公司招聘 怎样用TSQL建JOB xml参数存储过程 激情黄健翔 Head first design patterns 读书笔记 – Strategy(策略模式) 双击U盘出现“拒绝访问”的解决方法
如何在ReadOnly的DataGrid中的让CheckBox列可点击
chengbo · 2006-07-27 · via 博客园 - chengbo

把一个DataSet绑定到自定义列类型的DataGrid中,DataSet中有一列是bool值, DataGrid中相应的列是一个DataGridBoolColumn,呈现为CheckBox。

想要达到的效果是:DataGrid除了CheckBox列可以由用户点击改变值,其它的都为只读,不能编辑。

看起来挺简单件事,把DataGrid的ReadOnly设置为true,DataGridBoolColumn的ReadOnly设置为false就行了嘛,可是不知道为什么,这样设置后,CheckBox就是不能点击,郁闷。

换一个方式,把除了DataGridBoolColumn的其它列的ReadOnly设置为true,DataGrid的ReadOnly为默认的false。这样是达到了效果,可是DataGrid下面多了一行空白行,用户可以填入数据添加新行,也不行。

最后google了一下,终于解决了:

把DataSet转变为DataView,把它绑定到DataGrid上,同时DataView有一个属性AllowNew,把它设置为false后,再用上面的方法,就OK了,CheckBox可点击,同时不能添加新行。

希望对大家有帮助。