public string GetStatus(int id)
{ string str = dt.Rows[id]["STATUS"].ToString(); if (str == "-2")
{
status = "比对失败";
}
else if (str == "-1")
{
status = "提交完成";
}
else if (str == "0")
{
status = "比对中";
}
else if (str == "1")
{
status = "比对完成";
}
return status;
} <td align="center" class="text" height="20"><%=GetStatus(i) %></td>
我想在td中显示时, status不同,显示的颜色不同,怎么做啊?如获得到的status为"比对完成"则显示 绿色;status为"比对失败"则显示 红色.多谢
{ string str = dt.Rows[id]["STATUS"].ToString(); if (str == "-2")
{
status = "比对失败";
}
else if (str == "-1")
{
status = "提交完成";
}
else if (str == "0")
{
status = "比对中";
}
else if (str == "1")
{
status = "比对完成";
}
return status;
} <td align="center" class="text" height="20"><%=GetStatus(i) %></td>
我想在td中显示时, status不同,显示的颜色不同,怎么做啊?如获得到的status为"比对完成"则显示 绿色;status为"比对失败"则显示 红色.多谢
{ string str = dt.Rows[id]["STATUS"].ToString(); if (str == "-2")
{
status = "<font color=red>比对失败</font>";
}
else if (str == "-1")
{
status = "提交完成";
}
else if (str == "0")
{
status = "比对中";
}
else if (str == "1")
{
status = "<font color=green>比对完成</font>";
}
return status;
}
//后台
//长度超过8以后以省略号代替
public Object HtmlCode(object TString)
{
if (TString.ToString().Trim()= "比对失败")
{
return "<font color=red>" + TString + "</font>";
}
else if(TString.ToString().Trim()= "比对完成")
{
return "<font color=green>" + TString + "</font>";
}
}//前台
HtmlCode(<%=GetStatus(i) %>)