The Beauty of ASP.NET 2.0 Themes in Visual Studio 2005
(Page 1 of 6 )
This article introduces you to “ASP.NET 2.0 Themes” with the Visual Studio 2005 Integrated Development Environment. The sample downloadable application was developed using Visual Studio 2005 Professional Edition on Windows Server 2003 Standard Edition.
A downloadable file for this article is available
here.
Understanding “Themes” in ASP.NET 2.0
Any commercial website needs to spruce up its appearance now and then. Even though the appearance of a website may get modified periodically, the consistency of the entire website should always be maintained.
The most important issues for consistency are the coloring methodology and other look and feel strategies. In general, to maintain consistency throughout a website, style sheets (Cascading Style Sheets) have been a good choice. Style sheets have been introduced with DHTML, even before any server side technology was invented.
And later style sheets have been directly integrated into (almost) every server side technology available (along with ASP.NET). Applying CSS to HTML seems to be simple and easy, but applying the same to ASP.NET Server controls can be confusing, because it is up to the developer to know which HTML tags are rendered by the control and how they are rendered. Keeping such scenarios in mind, Microsoft introduced a new feature in ASP.NET 2.0 called “themes.”
Before understanding “themes,” we need to understand the concept of “skin.” A skin generally contains visual properties (for look and feel strategies) for one or more kinds of ASP.NET controls (server controls). Every skin is made with a set of skin tags, which are typically based on XML and XSLT specifications. At this movement (at the time of this writing), Visual Studio 2005 doesn’t have any intellisense support to work with skin tags. It is the developer’s responsibility to figure out the syntax of every skin manually.
Coming to the concept of “themes,” a theme is simply a collection of several skins and style sheets together with images. A theme really makes a web developer’s life very easy as they can define the appearance for a set of controls at design time and make them look coherent to the overall application. Web developers can apply theme to the application at control, page or application levels. This article mainly concentrates on the following issues:
- designing skins
- creating themes based on the skins
- applying themes to web pages
- applying two different appearances for the same kind of controls
- creating and applying Cascading Style Sheets to the theme
- applying themes at runtime.
Next: A simple demonstration of ASP.NET 2.0 skins and themes >>
More ASP.NET Articles
More By Jagadish Chaterjee