CSS StyleSheet in Theme not applied to 1 page out of 40 in site

Rate It (1)

Last post 07-28-2007 2:43 PM by Adam.Kahtava. 8 replies.

Sort Posts:

  • CSS StyleSheet in Theme not applied to 1 page out of 40 in site

    05-08-2007, 12:39 PM

    I have a strange situation with *1* content page in a site where it's not receiving the <link href... stylesheet....> tag at runtime from the Theme.

    Background:

    1 MasterPage that every page in the site uses.

    1 Theme (with only 1 css sheet) specified via

    <pages styleSheetTheme="myTheme">

    All other pages in the site show the <link> tag inserted at runtime and display correctly.

    But for some reason the <link> stylesheet tag just doesn't get injected into this one stupid page.  It's one of the main input form pages for the site and contains tables, textboxes, dropdowns, etc.

    *** If I manually add the <link> stylesheet tag to the MasterPage - everything including this 1 problem page - is correct.   (But I was hoping to let the Theme do it dynamically.)

    Anybody have any ideas?

    Thanks!

     

  • Re: CSS StyleSheet in Theme not applied to 1 page out of 40 in site

    05-09-2007, 5:04 AM

    Hi,

    If you provide the relate html source code , I think that may be able to help further,

    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
  • Re: CSS StyleSheet in Theme not applied to 1 page out of 40 in site

    05-09-2007, 8:03 AM

    I've seen some funny / quirky things happen with the way Themes automagically includes Style Sheets. In one instance I had about 10 copies of the same Style Sheet externally linked in my document's head.

    Be careful with using more that 30 Style Sheets - Internet Explorer has a 30 style sheet limitation, see article Q262161

  • Re: CSS StyleSheet in Theme not applied to 1 page out of 40 in site

    05-09-2007, 9:35 AM

    Well, unfortunately this input form is for internal company data and a lot of the Text/Labels/etc contain proprietary info that I have to remove..  so all I can really show you of the form isn't much.. :(

    <%@ Page Language="C#" MasterPageFile="~/Main.master" AutoEventWireup="true" CodeFile="maint_form.aspx.cs" Inherits="form_maint_form"  %>
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
    <%@ MasterType VirtualPath="~/Main.master" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    <p><asp:validationsummary id="vsSummary" runat="server"></asp:validationsummary></p>

    <p><span class="maint_form_confirm_message"><asp:label id="Label1" runat="server" Visible="False"></asp:label></span></p>

    <table>
    ...
    </table>

    <br /><br />

    ...lather, rinse, repeat..etc..


    <p><asp:button id="btnSubmit" runat="server" Text="Submit Form" OnClick="btnSubmit_Click"></asp:button
    <asp:button id="btnSubmit1" runat="server" Visible="False" Text="Confirm Form" OnClick="btnSubmit1_Click"></asp:button
    <asp:button id="btnEdit" runat="server" Visible="False" Text="Edit Form" OnClick="btnEdit_Click"></asp:button></p>

    </asp:Content

    The guts of the html is just table after table after table of input areas/sections.  There's nothing fancy about them - they dont even have separate submit buttons.  Most are simply textboxes and validators - but a few also contain databound dropdowns/radiobuttons.

    The page uses the watermark ajax toolkit control a few times, but the problem was happening before I even added the toolkit reference.

    Other than the html itself being VERY long - it numbers almost 1000 lines (yes i know it's crazy for 1 form to be that long - you should have seen it before I got it) - there's nothing special/fancy about it.  It's just a brute force approach to data collection.

    I'm really at a loss as to why it doesnt get the stylesheet link injected :(

    thanks!

  • Re: CSS StyleSheet in Theme not applied to 1 page out of 40 in site

    05-10-2007, 8:08 AM
    Answer

    What does the code behind look like? Are there any references to styleSheetTheme in the code behind or any references in pages derived from the code behind page? 

  • Re: CSS StyleSheet in Theme not applied to 1 page out of 40 in site

    05-10-2007, 9:15 AM

    The code-behind is massive (like the html) - but 75% of it is custom validator logic.  There's calls to several separate classes for performing various functions, db i/o, etc.  Lots of session variables being used and passed around on page redirects.  But unfortunately no references to themes or css of any kind. 

    One other thing I should mention is that the site was originally .NET 1.1 - but i've converted it to 2.0.  Well, let me define "converted" since you may get the wrong idea.  I hate the way 1.1 projects are "converted" to 2.0 using the conversion wizard - so I manually started with a new AJAX-enabled Web Site template and created each page, one by one - essentially copying the contents of the old page to the new one (along with reworking obsolete/outdated coding methods, etc).

    But since the original was 1.1, they weren't using master/content pages, themes, etc..  they weren't even using css for that matter.

    But I've finished the site and everythign is working perfectly except for the styling of this one page-

    any ideas would be appreciated-

     

  • Re: CSS StyleSheet in Theme not applied to 1 page out of 40 in site

    05-14-2007, 1:26 AM

     

    you could have a try to set the stylesheettheme in your code behind:

    this.Page.StyleSheetTheme = "SkinStyle";

    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
  • Re: CSS StyleSheet in Theme not applied to 1 page out of 40 in site

    07-18-2007, 2:14 PM
    Answer

    finally figured this one out and thought i'd share...

    I had overridden the OnInit event in the code behind of the page - and i'd FORGOTTEN to do:

    base.OnInit(e);

    (before doing my own stuff in the event..)

    and I'm guessing that's the event that handles applying the themes.

    Once I added that line back into my override OnInit event, the theme was applied just fine-

    Strange you'd think I'd have encountered some other issues as a result.. ?

     

  • Re: CSS StyleSheet in Theme not applied to 1 page out of 40 in site

    07-28-2007, 2:43 PM

    Congrat's Kenneth and thanks for sharing the resolution!

Page 1 of 1 (9 items)
Microsoft Communities
Page view counter