Change css via vb.net

I have a style.css file that gives the body color of each aspx page, since each page calls this css file. But on one page I need to change the body color through the vb.net code. is there any way to do this?

+4
source share
2 answers

You can set it as a style attribute of the body tag.

Me.Body.Style.add("background-color", "#FFFF00") 

(if your body tag has an identifier and the attribute runat = "server")

+3
source

Give the attribute <body> a ID and runat="server" , and then you can access it in code.

eg:

 <body ID="body" runat="server"> 

separated code:

 body.CssClass = "whateverYouWant" 
+2
source