Click here to Skip to main content
15,881,044 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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,

C#
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>");
Posted
Updated 26-Feb-15 23:30pm
v2

1 solution

try to make css file for Icon.you can find tutorial on css and implement it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900