By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,292 Members | 1,381 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,292 IT Pros & Developers. It's quick & easy.

Programmatically Creating Themes and Skins

P: n/a
According to the MSDN docs, we cannot programatically create our own themes
or skins:
"Page and control developers do not use the ControlSkinDelegate,
ControlSkin, or PageTheme classes directly. These classes are used by the
ASP.NET parser and runtime ... " (from
http://msdn.microsoft.com/en-us/libr...agetheme.aspx).

My question:
Is there really no way that we can programmatically create our own themes
and have ASP.NET apply them to our pages and controls? I would like to
programmatically create my own themse, and not have to go with the expected
App_Themes directory for all of my themes. Is there some alternative I can
use?

Thanks

Jun 27 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On 9 May, 09:23, "Cramer" <A...@B.comwrote:
According to the MSDN docs, we cannot programatically create our own themes
or skins:
"Page and control developers do not use the ControlSkinDelegate,
ControlSkin, or PageTheme classes directly. These classes are used by the
ASP.NET parser and runtime ... " (fromhttp://msdn.microsoft.com/en-us/library/system.web.ui.pagetheme.aspx).

My question:
Is there really no way that we can programmatically create our own themes
and have ASP.NET apply them to our pages and controls? I would like to
programmatically create my own themse, and not have to go with the expected
App_Themes directory for all of my themes. Is there some alternative I can
use?

Thanks
You can change the allocation of themes to controls programatically
just as you can dynamically associate CSS classes and styles. However
the dynamic creation of new style sheets and skin files is outside
their designed purpose. The location of the theme files is fixed
because that is where ASP.NET has been hard coded to expect them (or
maybe set in machine.config).

I'm not suggesting that this can't be circumvented in some way but I
wonder whether it's worth the effort. If there is a need to vary style
attributes at run time based on some computed criteria, then it
doesn't have to come from style sheets or skin files. It could be
derived from re-useable code of your own creation (e.g. in a class
file) consisting of functions returning style objects or other control
properties either based on the values supplied as parameters or on a
different function for each theme. It requires a bit of ingenuity but
at least the end result will be more system friendly and supportable.
Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.