Tech Off Thread

6 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Themes/Skins and ASP.NET

Back to Forum: Tech Off
  • User profile image
    Another_​Darren

    So I've just read up on themes and skins in ASP.NET 2.0.

    What was the idea supposed to be?  Alright it gives to away to set a common standard for all your controls, but I think we already had a method for doing that called CSS.

    I'm stumped as to why MS decided to invent skins over just integrating CSS better in VS!

    Anyway I'm interested in the following views the niners;

    • What is your experiences with skins? (Love/Hate/Issues)
    • What alternatives have you used to theme/brand your sites?
    • If anybody knows the benefits of using skins over CSS or other methods (expecially why MS choose this solution)?

  • User profile image
    W3bbo

    They implemented it because:

    • WYSIWYG "programmers" can't tell CSS from Javascript, better to give them a more "friendly" version that doesn't involve learning "non-Microsoft" technologies
    • CSS doesn't let you change the generated markup
    • Skins only need a single file changed, when you change a stylesheet you need to change the <link> element in every page (somewhat time consuming unless you're using a style-switcher control)

  • User profile image
    Another_​Darren

    W3bbo wrote:
    They implemented it because:

    • WYSIWYG "programmers" can't tell CSS from Javascript, better to give them a more "friendly" version that doesn't involve learning "non-Microsoft" technologies
    • CSS doesn't let you change the generated markup
    • Skins only need a single file changed, when you change a stylesheet you need to change the <link> element in every page (somewhat time consuming unless you're using a style-switcher control)


    If you're developing a web app and don't know about CSS then I'd question if you are in the right job.

    As for changing the markup. if you just pump of control specific markup and no styling you can skin it with CSS.  CSS gives you better control of the whole web site look and feel that Skins and you can take advantage of web developers to brand your site.

    Updating the links could have been setup like themes are now.  Identify a css file for the site with page declarations to override specific pages.

    With css you could take a sites currently design and just implement the same tags/ids and done.  With skins you have to create you style all over again in a different format.  Plus I bet there are more web deisgners out there that know css over MS format.

  • User profile image
    jason2584

    One of the only reasons I've used skins is to change settings on certain web controls that can't easily be overcome with CSS. For example, there are settings in the Calendar control that have no associated CssClass property, and it becomes painful to try to style the control consistently without having as much markup on each control declaration as you do CSS to style it. My Calendar.skin file looks like this:

    <asp:Calendar runat="server"
    SelectionMode="day"
    DayNameFormat="shortest"
    CellPadding="3"
    TitleStyle-BackColor="#ccddee"
    NextMonthText="&raquo;"
    PrevMonthText="&laquo;"
    CssClass="calendar"
    TitleStyle-CssClass="title"
    NextPrevStyle-CssClass="nextprev"
    DayHeaderStyle-CssClass="dayheader"
    DayStyle-CssClass="day"
    WeekendDayStyle-CssClass="weekend"
    OtherMonthDayStyle-CssClass="othermonth"
    SelectedDayStyle-CssClass="selected"
    TodayDayStyle-CssClass="today" />


    I can't set the 'NextMonthText' and 'PrevMonthText' with CSS, and I don't want to set it everytime I use the Calendar control. Also, I'm able to set my CssClass properties once, and not have to specify them at each declaration. I'm now able to declare Calendar controls that look nice and are styled with CSS with just the following declaration:

    <asp:Calendar ID="calPicker" runat="server" />

    Cleaner functional code makes life easier, so I take advantage of it. It's nice not having all the extra cruft to sift through when I'm looking through the markup for something.

  • User profile image
    jmacdonagh

    Any CSS files that reside in the current theme's directory get automatically included into any page that uses that theme. Themes aren't supposed to replace CSS. Themes are supposed to supplement it with the ability to customize web controls. I'm sure most ASP.net developers would use theme files for web control customization and the included CSS support for styling.

  • User profile image
    MB

    W3bbo wrote:
    They implemented it because:

    • WYSIWYG "programmers" can't tell CSS from Javascript, better to give them a more "friendly" version that doesn't involve learning "non-Microsoft" technologies
    • CSS doesn't let you change the generated markup
    • Skins only need a single file changed, when you change a stylesheet you need to change the <link> element in every page (somewhat time consuming unless you're using a style-switcher control)


    Skins and Themes are a higher level of abstraction than CSS et-al

    Skins are a run-time asp:declaration (albeit, a subset of the full object's asp:declaration)... and css is simply a by-product of that process. i.e. "CssClass" property is part of the skin.

    Themes are a way of grouping skins into a consistent presentation.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.