CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

ASP.NET Web Hosting – 3 Months Free!



Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 3/3/2008 6:55:59 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 2 Views: 30 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
3 Items, 1 Pages 1 |< << Go >> >|
newbie06
Asp.Net User
Theming with multiple CSS files some hard coded some changed programmatically3/3/2008 6:55:59 PM

0/0

This is my first attempt at Theming. I would like to make good use of Themes. Here is that situation that I have.I have a master.css which applies to every page, I also have iewin-hacks.css which applies to every page. Then I have a green.css, brown.css, blue.css etc. which changes the theme of the page. I started to make a Green, Blue and Brown theme folder and cut and paste the master.css and iewin-hacks.css into every folder. I was hoping for a better way of doing this. Basically the master.css and iewin-hacks.css applies to every page no matter what theme the user picks only the Green.css, Blue.css or Brown.css changes.Could I have a DefaultTheme folder where I add the master.css and iewin-hacks.css and then have a theme folder for every special theme which would have one css, images and skin file?

How would that work if I have the master.css and iewin-hacks hard coded in my Master Page and only change the user chosen theme on the fly? Is this doable? Can anybody help a Themes newbie.

<link href="../App_Themes/Default/master.css" rel="stylesheet" type="text/css" />************This theme would have to change on the fly via C# codebehind in the Master Page.***********<link href="../App_Themes/GreenTheme/green.css" rel="stylesheet" type="text/css" /> <!--[if IE]><link href="../App_Themes/Default/iewin-hacks.css" rel="stylesheet" type="text/css" /><![endif]-->

 

avanslaars
Asp.Net User
Re: Theming with multiple CSS files some hard coded some changed programmatically3/3/2008 11:00:59 PM

0/0

Your best bet would be to include your shared (master and iewin-hacks) stylesheets in a directory in the root of your site, say "styles". Then add links for those into your masterpage. Put your theme specific styles, images, etc. into theme directories and set the theme as you would normally. The shared CSS should be included since they are referenced in your masterpage. I also think you could use runat="server" in your <link> tag, allowing you to use the "~/.." style path to ensure that the path works on any page, even those in sub directories. The only issue you might have is your stylesheets being referenced out of order. depending on how much you rely on the cascading part of CSS, order may or may not be an issue for you.

Hope this helps.
 


Andrew L. Van Slaars

vanslaars.net
Amanda Wang - M
Asp.Net User
Re: Theming with multiple CSS files some hard coded some changed programmatically3/5/2008 8:59:57 AM

0/0

Hi,

If you want to change the theme programmatically, you should change it in the content page's preinit event.

If you have so many page, you can try to create a basepage class that inherits from System.Web.UI.Page and override the OnPreInit event, setting the Theme there. You can then add the following to the web.config: <pages basePageType="MyBasePage" />

The page's will  inherit from the new base page , and where the PreInit will run and set the theme automatically .

Hope it helps.


Please remember to mark the replies as answers if they help and unmark them if they provide no help.


Yours sincerely,
Amanda Wang
Microsoft Online Community Support
3 Items, 1 Pages 1 |< << Go >> >|


Free Download:


Web:
Theming with multiple CSS files some hard coded some changed ... Theming with multiple CSS files some hard coded some changed programmatically. Last post 03-05-2008 3:59 AM by Amanda Wang - MSFT. ...
K. Scott Allen : ASP.NET Themes On A Sunday Afternoon Some controls in .NET 2.0 are just very hard to use with CSS (the Calendar .... .cs files, for example), you've lost the chance to globally change the theme ...
Smarty :: View topic - Multiple/Styles : Suggestions of Best Practice? Images and CSS files live within DOCROOT/images/THEME and ... The default theme is hard coded in this example, but I actually use a variable ...
Cutting Edge: Dress Your Controls for Success with ASP.NET 1.1 Themes A CSS file can dictate the appearance of some page elements such as body, .... Reflection-based code is often hard to read and maintain if you use it for ...
Specifying the Master Page Programmatically : The Official ... A Theme is a collection of images, CSS files, and style-related Web control .... We can update this code to base the master page on some external factor. ...
mezzoblue § CSS Optimization Sep 16, 2005 ... Before we wrote a line of code, we put in some manual leg work to .... It would be much better if the top of the CSS file defined a theme, ...
$Id: CHANGELOG.txt,v 1.173 2006/12/23 22:07:37 dries Exp $ Drupal ... changed block system: * various hard coded blocks are now dynamic. ... updated the themes: tidied up some HTML code and added new Drupal logos. ...
Inside Microsoft: Styling a Site using Themes In the previous article in this series, I introduced some of the tools to assist ... Now, using themes, you can not only apply a CSS style sheet file to all ...
CodeProject: Some Cool Tips for .NET. Free source code and ... Dec 14, 2005 ... These article discusses some tips for commonly faced problems in . ... of code generates PDF version of Crystal Report programmatically. ...
Master Pages, Themes, and Control Skins You can programmatically change the Master Page in code using the .... Themes folder showing control skins and CSS.Note that the .css file names match the ...




Search This Site:










master page mystery event solution

login control on a masterpage with a button... enter not behaving

menu control and parent/child page problem.

how can i post and get the hidden values from child page

hide sub menu item

master pages + file path

first level menu hover issue

mulitple (nested) themes... can it be done?

how to set theme for the whole web application instead of a single web page

css not applied in any pages with a theme

setting title of content page

multiple root items on menu not showing up

system.configuration.provider.providerexception: this property cannot be set for anonymous users

[idea] master page htmlhead base tag

cannot use a leading .. to exit above the top directory

fixed column widht not working

masterpages and #includes

treeview and postbacks in ie

master page issues with sqldatasource

get selected value for sqldatasource select parameter located in content page from listbox located in master page

menu problem in firefox

rendering problem with asp:menu "skip navigation links" image

css theme class won't refresh

masterpage <head> content

subfolder, web.sitemap and selected

want to use base classes for code behing inheritance / shared logic

issue with usercontrol in masterpages

css in theme doesn't override original properties

css in content page

master pages with themes problem (how to i convert c# code to vb)

  Privacy | Contact Us
All Times Are GMT