Actually, there is a difference between class and CssClass: the class will not be seen by the code behind, but the CssClass will.
Thus, if you add a new class to a control in your code behind, for example:
myControl.CssClass += " foo";
while your control is set as follows:
<asp:TextBox class="Text" ID="myControl" runat="server" />
(Note class attribute: class="Text"
)
When inspecting your rendered element in your browser, you will see that it will be rendered as follows:
<input class=" foo" name="ctl00$MainContent$myControl" type="text" id="MainContent_myControl" >
(Note how the class has been overridden: class= " foo"
.)
If you set the CssClass on the other hand:
<asp:TextBox CssClass="Text" ID="myControl" runat="server" />
you will get it rendered (as expected) like so:
<input class="Text foo" name="ctl00$MainContent$myControl" type="text" id="MainContent_myControl">
(note the class has now both classes set, as expected! class="Text foo"
)