Reputation: 21282
this.Style.Add ( /*...*/ )
... doesn't appear to work.
What do I need to do to add a style to it?
Upvotes: 1
Views: 9077
Reputation: 2438
You may wrap your user control into another html container (div for example) and set style on container.
Upvotes: 2
Reputation: 5644
Think about the nature of UserControl - it's intended to contain other ASP.NET controls and that's why you cannot set CSS for whole control.. instead you just need to specify styles for each child control individually. You can also take a look at the ApplyStyleSheetSkin method.
Upvotes: 5
Reputation: 54618
If your user control is inheriting from webcontrol simply use the system.web.ui.webcontrols.webcontrol.cssclass (msdn). Example in the link.
Upvotes: 1