DataGrid列颜色更改

编程入门 行业动态 更新时间:2024-10-28 13:18:49
本文介绍了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列颜色更改

本文发布于:2023-11-11 10:07:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1578122.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:颜色   DataGrid

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!