SmartNavigation, Stylesheets and Frames

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a situation where my stylesheet seems to be ignored when I set the smartNavigation property to True. Can someone please tell me what I'm doing wrong or how I should be doing this

I have a project with a stylesheet (Styles.css) in which I define a syle class. The start page is a frameset with a frame that points to a web form that is located in a sub-folder (i.e. MySubFolder\WebForm1.vb). This web form references the stylesheet in the folder above. Thus, the link to the stylesheet is as follows
<LINK href="../Styles.css" type=text/css rel=stylesheet
On the web form I have a single button and a label. The label's CssClass property is set to the name of the my style class defined in Styles.css
When smartNavigation in WebForm1 = false everything works fine. The label is rendered using the style defined in Styles.css. When I click the Button the page is re-rendered correctly
HOWEVER...when I set smartNavigation in WebForm1 = true, the page is initially displayed correctly, but when the button is clicked and the page is re-rendered, the style seems to be completely ignored. Interestingly, if I change the <LINK...> tag to the stylesheet in WebForm1 to look not look in the parent folder (i.e. '<LINK href="Styles.css" type=text/css rel=stylesheet>'), the page initially displays incorrectly, but after clicking the Button, it displays correctly

Can anyone tell me a neat way of working with this unusual behaviour

Sleepy
 
One workaround uses some client side JavaScript to attach the
stylesheet after the page loads. For example, you could place the
following script block in your ASPX:

<script>
function AttachStyleSheet()
{
document.createStyleSheet(
href="http://server/Styles.css");
}
</script>

Then you can invoke this method by adding an event handler for the
body onload:

<body onload="AttachStyleSheet()>"


HTH,
 
Back
Top