Aug 29, 2012 at 4:10 PM
Edited Aug 29, 2012 at 4:16 PM
I am creating a module that will allow admin to change the class of the body tag. I have the back end working and the admin can change the value to one of 5 options and successfully save this in the database.
What I want to do is to have code on the view which changes the class of the body tag. This should be easy enough to do this with JS but was wondering if this can be done using C# in Razor.
Currently my body tag looks like
I can change the value by hard coding into the layout.cshtml
string cssClass = "theme1";
Can I have something similar in my view (Module/Views/Parts/module.cshtml) that retrieves this value from layout.cshtml or is there other code options that finds body tag similar to getElementById JS code that I can use top change the class that way?