Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 485 Vote(s) - 3.46 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ASP.NET Themes - Should They Be Used?

#1
I'd been reading up on themes in my ASP.NET book and thought that it could be a very handy solution, then I met some problems.

* The theme picks up every single CSS file in the folder
* If you want to use reset styles (where ordering is important) the order of imported stylesheets is not guaranteed
* Your master page would not explicitly indicate what style is being used, only the rendered page can tell you that unless you dig into your web.config
* Styling web controls using the theme file is... well... stupid? You can simply do this in your stylesheet. Granular control should be at the HTML level, should it not?
* How do you specify print stylesheets without having all styles in a single stylesheet?

I'm wondering as to whether they're actually worth using at all. Is there any benefit? Are there any major sites using them?

**EDIT**

Just to clarify slolife's last point. If I had two stylesheets, one called print.css and one called main.css and I used ASP.NET themes, how would it know that print.css was a print stylesheet? In regular HTML you use the media type in the tag itself (i.e. `<link rel= ...>`) but the themes wouldn't know this, so it would just get included as a regular stylesheet.
Reply

#2
IMHO, asp.net themes are absolutely USELESS

try implementing url rewriting with an app which uses themes and see them break straight away

basically, you can achieve the same thing writing few lines of code in asp.net and multiple css folders. i am yet to come across any developer / company who has been using themes

when asp.net 2.0 was launched, there was a big hype around themes but my personal opinion is its simply not worth it :-)
Reply

#3
I like using themes, but as Raj pointed out in his answer, URL rewriting can cause problems. My search for some solutions to that is what led me to your question. But I'll add my opinions in anyway.

I'll address some of your bullets from above as to why I think themes are good:

*- The theme picks up every single CSS file in the folder*

I guess you are looking to apply only certain stylesheet files to certain pages. Yes, themes takes the shotgun approach here, so that's a problem. But you don't have to put all stylesheets in the the theme folder. Put your specialized ones outside of it and they won't be included automatically. But I think it is nice feature to have the common/site wide ones included automagically.

*- If you want to use reset styles (where ordering is important) the order of imported stylesheets is not guaranteed*

I think you can guarantee the order by the way you name the files, so they are numerically and alphabetically ordered. Maybe not an elegant solution, but not horrible.

Personally, I have a build step that combines and compresses all of the *.css files in my theme folder into one single style.css file, and since I control that build step and the order that the files are combined, that doesn't affect me.

*- Your master page would not explicitly indicate what style is being used, only the rendered page can tell you that unless you dig into your web.config*

You can change the theme via code and in the <%@Page directive

*- Styling web controls using the theme file is... well... stupid? You can simply do this in your stylesheet. Granular control should be at the HTML level, should it not?*

I agree that applying style attributes to controls via the theme doesn't seem to be a best practice. But I love the fact that I can define image skins in the theme's skin files and don't have to cut and paste Width,Height,AlternativeText,Align attributes for common images that I use lots of places throughout the site. And if I ever change one of those images, I can fix the attributes in one place, rather than all over. I also can created skinned controls with a certain list of css classes applied, which seems handy to me.

*- How do you specify print stylesheets without having all styles in a single stylesheet?*

I have a Print.css file that starts with @media print and that defines print styles for my site. Why do you need to put them in one stylesheet?


Reply

#4
Use themes to change control attributes ONLY.
They were bad designed for working with css.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through