Reputation: 49
I have a key with name ENV in config, I have written the following line in layout.cshtml
<span [email protected]["Env"]>@User.Identity.Name
</span>
How to write javascript function or suggest some other way to apply different css class file based on ENV value.
Upvotes: 0
Views: 1175
Reputation: 1039140
You could define a CSS rule in your CSS file that will match the value in your web.config:
.someValue {
color: Red;
}
This assumes that in your web.config you have the Env
key defined:
<add key="Env" value="someValue" />
Also make sure you put quotes around the class value:
<span class="@System.Configuration.ConfigurationManager.AppSettings["Env"]">
@User.Identity.Name
</span>
Upvotes: 1