SmartNavigation, Stylesheets and Frames

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
 
S

Scott Allen

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,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top