0

I have a folder /css which contains a number of generic css stylesheets

How can I apply a ccs stylesheet to a specific UserControl only in a page given I would like to use the same stylesheet with other UserControls?

The css is injected dynamically into the document so the css has no knowledge of what UserControl is currently showing.

There may be up to 4 different css documents injected into the same page, however, each should only affect one user control.

Any ideas on how I could do this?

jax
  • 37,735
  • 57
  • 182
  • 278

2 Answers2

0

may be providing the user control with it's own skin file, and css file would work for you. And as theme is done in Page_PreInit which is not available for UserControl we still have an option.

Theme in user control

Apply Themes dynamically for UserControl in Silverlight 4.0

OR

How to make user controls know about css classes in ASP.NET

Community
  • 1
  • 1
Ashwini Verma
  • 7,477
  • 6
  • 36
  • 56
0

I am not sure if I have understood your question correctly. I think css inheritance can help you out in it.

Suppose for first user control make an outer most div named mainDivCtrl1, than the classes that you want to apply inside your control should be like:

.mainDivCtrl1 div {

}

.mainDivCtrl1 table {

}

Similarly you can do it for other controls as well.

Imran Balouch
  • 2,170
  • 1
  • 18
  • 37