I have ordinary div like this:
<div id="myCoolElement" runat="server"></div>
I want use the construction to set CssClass for myCoolElement like this:
myCoolElement.CssClass("mycoolstyle");
But CssClass property is supported only for WebControls.
How I can set CssClass for my element without creating WebControl?
Mark Devid
12-Dec-2014Try this.
myCoolElement.Attributes.Add("class", "mycoolstyle");
Anonymous User
12-Dec-2014You can do like this
myCoolElement.Attributes["class"] = "mycoolstyle";