views:

263

answers:

1

When developing a web user control, I'm styling everything with CSS. Whenever I look at the control in the designer, none of the CSS is rendered, or course, because I'm not looking at it in the context of the page where my link element is declared to my CSS file. Plus, Visual Studio will include a warning:

The class or CssClass value is not defined.

for every class attribute I use.

I can get the designer to render the CSS if I include a link element in the control itself, but then I have duplicate link elements scattered throughout my pages.

Is there any way to get the designer to play nice with my CSS in a web control without injecting duplicate link elements everywhere?

+1  A: 

Sadly at the moment, I think that's the best you're going to get as seen here.

The only good news I can see is this Connect Issue which is "Closed - Postponed", so they may well be thinking about it.

The issue you've got is that you can make a control display very differently depending on the CSS rules applied with the styles - so one style sheet or a combination of parent tags could make (for example) labels appear above their form elements, and another beside them - which would you want to display when you are viewing the User control out of the page context?

Zhaph - Ben Duguid
I couldn't find that question in my search. It pretty much sums up my question. Thanks again.
Aaron Daniels