Just a short note to those who are messing with a control's CssStyleCollection behind the Style property...
Even tho css style property names are case insensitive according to the css spec, the CssStyleCollection is case sensitive with it's keys. Therefore the following:
<script runat="server" language="c#" >
protected void Page_Load( Object sender, EventArgs e ) {
Result.Text = "Foo";
Result.Style["COLOR"] = "BLUE";
Result.Style["color"] = "red";
}
</script>
<html><body><form runat="server" >
<asp:Label runat="server" Id="Result" />
</form></body></html>
Results in the following style:
<span id="Result" style="COLOR:BLUE;color:red;">Foo</span>
Personally, I think this is rather... wrong. In case you want to know why this matters... I came across it while trying to transfer the “grid layout” style properties that vstudio makes from one control's style to another's. Vstudio uses uppercase style declarations, which, apparently and unfortunately, matters.