【发布时间】:2014-02-10 20:06:16
【问题描述】:
我想改变一些特殊词而不是gridview单元格中所有词的颜色。 代码如下:
protected void gvContents_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.Cells[3].Text.Contains("Special"))
{
//set The "Special" word only forecolor to red
}
else if (e.Row.Cells[3].Text == "Perishable")
{
//set The "Perishable" word only forecolor to blue
}
else if (e.Row.Cells[3].Text == "Danger")
{
//set The "Danger" word only forecolor to yellow
}
}
}
单元格文本可能如下所示:Radioactive : Danger 或此:Human Body : Special ,Perishable。我该怎么办?
【问题讨论】:
标签: c# css asp.net gridview colors