views:

14

answers:

1

I have a my own custom web server control. I created separate CSS file with CSS classes description for this control. I do not want to add tag to all pages where it is used. So, I believe that there is any way to connect CSS file directly to control. Is there any way to do it?

And what is the best method to add styles to web server custom control?

+1  A: 

This question might work for you. It's for a Custom Control, not a Server Control, but it would only change the method in which CSS stylesheet is dynamically added (not Page_Init(), but maybe Render()?).

That seems to be the only way: a must always be added, though automatically, if an external CSS stylesheet has to be used.

antur123
Agree with adding it dynamically via code-behind. +1
Sam