By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,264 Members | 1,271 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,264 IT Pros & Developers. It's quick & easy.

SmartNavigation, Stylesheets and Frames

P: n/a
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
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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,

--
Scott
http://www.OdeToCode.com

On Sun, 2 May 2004 18:36:03 -0700, Sleepy
<an*******@discussions.microsoft.com> wrote:
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


Nov 18 '05 #2

P: n/a
Thanks, Scott, it works like a dream!
Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.