Add the runat="server"
attribute to it so you have:
<div id="formSpinner" runat="server">
<img src="https://stackoverflow.com/questions/175381/images/spinner.gif">
<p>Saving...</p>
</div>
That way you can access the class attribute by using:
formSpinner.Attributes["class"] = "classOfYourChoice";
It’s also worth mentioning that the asp:Panel
control is virtually synonymous (at least as far as rendered markup is concerned) with div
, so you could also do:
<asp:Panel id="formSpinner" runat="server">
<img src="https://stackoverflow.com/questions/175381/images/spinner.gif">
<p>Saving...</p>
</asp:Panel>
Which then enables you to write:
formSpinner.CssClass = "classOfYourChoice";
This gives you more defined access to the property and there are others that may, or may not, be of use to you.