本文介绍了DataGrid列颜色更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在datagrid中有一个名为"Colum22"的列, 我想在出现"True"时更改数据的颜色 C#代码:
Hi, I have a colum in datagrid called "Colum22", I want to change the color of the data when "True" occurs C# code :
Protected voide ongridrowdatabound(object sender, GridRowevent args) { args.row.Cells[22].ForeColor =System.Drawing.Color.Red; if(args.row.Cells[22].text == "True") { for (int i=1;i<args.Row.Cells.Count;i++) { args.Row.Cells[i].Backcolor = System.Drawing.Color.DarkGray; } }错误: 该代码不管IF条件如何都会更改列数据(所有列都变成红色),请给我解决方案 在此先感谢....
ERROR: This code changes the column data irrespective of the IF condition (All the columns are turned in to RED color ) Please give me a solution Thanks in advance ....
推荐答案请点击链接.以某种方式可能对您有帮助. 在运行时在DataList中显示彩色项目并处理DataListItem CheckBox事件 [ ^ ] 谢谢 Please follow the link..somehow it may help you. Display Colored Items in DataList at runtime and handling the DataListItem CheckBox event [^] Thanks
更多推荐
DataGrid列颜色更改
发布评论