mvc 4控制器中的图标颜色变化。 [英] Icon color change in mvc 4 controller.
本文介绍了mvc 4控制器中的图标颜色变化。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的asp .net mvc 4项目中,我需要更改Icon的颜色。默认我给的是绿色。对于某些条件,我需要改变颜色。此代码用于控制器。没有使用任何视图。
这是我的代码,
In my asp .net mvc 4 project I need to change the color of Icon. Default I give is green. For certain conditions I need to change the color. This code is Used in controller. No view is used.
Here is my code,
string ClassName = "icon-message";
sb.Append("<table>");
foreach (var user in notific_list)
{
if (user.Notify_Act_Type == 174) //
{
ClassName = "icon-time";
}
else if (user.Notify_Act_Type == 175)
{
ClassName = "glyphicon glyphicon-credit-card";
}
else if (user.Notify_Act_Type == 176)
{
ClassName = "icon-plane";
}
else if (user.Notify_Act_Type == 177)
{
ClassName = "icon-inbox";
}
else if (user.Notify_Act_Type == 178)
{
ClassName = "icon-remove-sign";
}
sb.Append("<tr>");
sb.Append("<td>");
sb.Append("<span class=\""+ClassName+"\" style=\"color: green; font-size: 15px\"></span>");
sb.Append("</td>");
推荐答案
尝试为Icon创建css文件。你可以在css上找到教程并实现它。
try to make css file for Icon.you can find tutorial on css and implement it.
这篇关于mvc 4控制器中的图标颜色变化。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文