I understand that we can set the various style attributes from code behind using :
divControl.Style("height") = "200px"
But how to set it's class instead of declaring each of the styles from code?
I understand that we can set the various style attributes from code behind using :
divControl.Style("height") = "200px"
But how to set it's class instead of declaring each of the styles from code?
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"