C#.NET DataGridView 让部分单元格变成只读的例子程序
最近客户有让DataGridView中的部分单元格变成只读的需求,例如下面的效果图
实现参考代码如下:
for (int i =0; i <this.grdRole.Rows.Count; i++)
{
DataRow dataRow = (this.grdRole.Rows[i].DataBoundItem as DataRowView).Row;
if (dataRow[BaseRoleTable.FieldAllowEdit].ToString().Equals("0")
{
// this.grdRole.Rows[i].Cells[3].ReadOnly = true;
// this.grdRole.Rows[i].Cells[4].ReadOnly = true;
this.grdRole.Rows[i].Cells["colEnabled"].ReadOnly =true;
this.grdRole.Rows[i].Cells["colDescription"].ReadOnly =true;
}
}
C#.NET DataGridView 让部分单元格变成只读的例子程序相关推荐
- datagrid设置单元格边框_如何设置datagridview某一个单元格的边框样式
如何设置datagridview某一个单元格的边框样式 关注:153 答案:2 mip版 解决时间 2021-01-27 02:18 提问者浅沫记忆 2021-01-26 14:32 如何设置da ...
- Windows Forms DataGridView 中合并单元格
Windows Forms DataGridView 没有提供合并单元格的功能,要实现合并单元格的功能就要在CellPainting事件中使用Graphics.DrawLine和 Graphics.D ...
- DataGridView 中合并单元格
Windows Forms DataGridView 没有提供合并单元格的功能,要实现合并单元格的功能就要在CellPainting事件中使用Graphics.DrawLine和 Graphics.D ...
- DataGridview单击某个单元格选中一行
DataGridview如何单击某个单元格选中一行? 代码的方式设置 this.dataGridView1.SelectionMode = DataGridViewSelectionMode.Full ...
- datagridview 单击某个单元格选中一行
首先: this.dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;//设置为整行被选中 然后,在dataGr ...
- dataGridView获得选中单元格行索引
获得选中单元格行索引 (1) int _tempIndex =-1: private void dgv_TemplateMsg_CellClick(object sender, DataGridVie ...
- Winform DataGridView列的单元格中动态添加图片和文字
先上图在说,第二列中图片和文字的样式 1.需要重写DataGridViewTextBoxColumn,新建类TextAndImageColumn.cs 1 using System; 2 using ...
- C# DataGridView 获取当前单元格输入内容
/// <summary> /// 编辑控件显示事件 /// </summary> /// <param name="sender"></ ...
- DataGridView取得或者修改当前单元格的内容
当前单元格指的是 DataGridView 焦点所在的单元格,它可以通过 DataGridView 对象的 CurrentCell 属性取得.如果当前单元格不存在的时候,返回Nothing(C#是nu ...
最新文章
- Microsoft Agrees to Acquire ProClarity
- Exchange 2013部署系列之(五)NLB负载均衡
- HDU2032杨辉三角(C++)
- 密度图的密度估计_箱形图、小提琴图、直方图……统统可以卡通化!
- 9读书1-我在义务发财(1)
- scala 方法重载_Scala中的方法重载
- android fragment fragmenttransaction,Android FragmentTransaction 常用方法总结
- Nodejs创建简单的Bot
- centos赋予访问权限
- 不开机win7计算机还原,Win7开机出现Windows错误恢复解决方法
- 2020年中国干旱灾害受灾面积、饮水困难人口数量及造成经济作物损失分析[图]
- 各种符号用英语怎么念
- 【计算机视觉】Lecture 11:LoG和DoG滤波算子
- UTM——统一威胁管理
- MSDTC 分布式事务错误解决
- 15-英特尔驱动下载安装
- null == 什么意思? 和 ==null是不是一个意思啊?
- 【ArcGIS】ArcGIS Editor for OpenStreetMap 各版本稳定下载链接
- 写代码应该用什么字体?
- 诺顿360偷偷挖矿被怒喷 官方却说:都是为了用户好
热门文章
- android http封装类,HTTP封装类 工具类 For Android
- python点操作符语法,Python 语法之操作符和表达式
- 第一个go程序: HTTP 服务示例
- 三次iframe框架切换
- 关于软件测试工程师所应该具备的能力,就业前景还有适合女生从事吗?
- oracle 错误码1438,一次ora-01438错误的处理
- asp.net core文档下载_推荐一个必备的开源项目 (附下载链接)
- build tut framework on ubuntu
- mysql 1539_MySQL:半同步(三)从库端初始化和回调函数
- 高等院校计算机考试等级,全国高等院校计算机等级试考试大纲.doc