I'm working on creating a server control. There will be a bit of client side actions. Mostly, javascript will change the style when the mouse moves over parts of the control. The aspect I can't seem to find any info on is how to define the styles.

For the javascript it simple, just call RegisterClientScriptBlock(). However, I can't find a similar function for writing css. I suppose I could write it in the Render() function. However, that'll write the css once for each instance of the control on the page. Maybe, I could prefix the style names with the control id so at least each set of styles will have unique names.

I suppose another approach is to not write css styles to the page and instead have javascript change each style property one at a time instead of just changing the class name. However, this approach just seem like a bad approach.

Could someone explain or direct me to a reference to exlains the correct way to do this?


Thanks,