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

推荐订阅源

C
Check Point Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
W
WeLiveSecurity
T
Troy Hunt's Blog
Project Zero
Project Zero
Security Archives - TechRepublic
Security Archives - TechRepublic
Attack and Defense Labs
Attack and Defense Labs
Google DeepMind News
Google DeepMind News
T
Threat Research - Cisco Blogs
T
Tenable Blog
Jina AI
Jina AI
Recorded Future
Recorded Future
T
The Exploit Database - CXSecurity.com
N
News | PayPal Newsroom
P
Palo Alto Networks Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
G
GRAHAM CLULEY
A
Arctic Wolf
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Register - Security
The Register - Security
Last Week in AI
Last Week in AI
P
Privacy & Cybersecurity Law Blog
Microsoft Azure Blog
Microsoft Azure Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
SecWiki News
SecWiki News
S
Schneier on Security
有赞技术团队
有赞技术团队
IT之家
IT之家
美团技术团队
Cisco Talos Blog
Cisco Talos Blog
NISL@THU
NISL@THU
P
Proofpoint News Feed
C
CERT Recently Published Vulnerability Notes
Hacker News: Ask HN
Hacker News: Ask HN
罗磊的独立博客
博客园_首页
Cyberwarzone
Cyberwarzone
Forbes - Security
Forbes - Security
H
Hacker News: Front Page
爱范儿
爱范儿
云风的 BLOG
云风的 BLOG
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Webroot Blog
Webroot Blog
Latest news
Latest news
D
DataBreaches.Net
Know Your Adversary
Know Your Adversary
P
Privacy International News Feed
宝玉的分享
宝玉的分享
Simon Willison's Weblog
Simon Willison's Weblog
N
News and Events Feed by Topic

博客园 - 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可点击,同时不能添加新行。

希望对大家有帮助。