Set the css class of a div using code behind

<>

This question already has an answer here:

Answers


C#

divControl.Attributes["class"] = "myClass";

VB

divControl.Attributes("class") = "myClass"

You'll need to have a rule like this one on your css file

.myClass
{
   height:200px; 
   /*...more styles*/
}

This way you can define full style inline, without separate class declaration:

divControl.Attributes("style") = "height:200px; color:Red"

Need Your Help

Getting NPM installed on Raspberry Pi (Wheezy Image)

raspbian node.js

I was lucky enough to get a Raspberry Pi under the tree this year and I've had a bit of fun playing with Node.js on the device. However, Node.js is much more interesting when you can pull down pack...

Quick ways to test OLE DB Connection String

.net connection-string oledb database-connection

For debugging purpose I'd like to know ways to test OLE DB connection string quickly.