jyothis
jyothis

Reputation: 49

how to change layout of the page based on environment value using Jquery in Asp.Net MVC3

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

Answers (1)

Darin Dimitrov
Darin Dimitrov

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

Related Questions