类型:转载 责任编辑:asp.net 日期:2007/05/23
热门软件下载:
我需要做一个DataGrid,一行中的数值项目小于0的时候,想把Item的背景色变成黄色
该怎么做?
网友回答:
先设置选中行的颜色
然后在ItemCreated事件下写代码
把你需要变色的行变为选中行即可
Item_dataBound时
try
{
if(Int32.Parse(e.Item.Cells[选中项序号].Text)<0)
{
e.Item.Cells[选中项序号].Attributes["bgcolor"]="#ffff00"
}
}
catch(..)
{
..
}
http://community.csdn.net/Expert/topic/3434/3434223.xml?temp=.7720606