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?

Aaron Daniels
  • 9,563
  • 6
  • 45
  • 58
  • Your post only describes a subset of the larger problem. VS Web Forms designer doesn't display CSS3 correctly at all, even within a page context. I'm using VS2015 Update 3 and even `Default.aspx` doesn't display correctly in a brand-new project (bootstrap layout is messed up). Running the project shows it fine in the browser though. – dotNET Jun 28 '16 at 13:21

1 Answers1

2

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?

Community
  • 1
  • 1
Zhaph - Ben Duguid
  • 26,785
  • 5
  • 80
  • 117