Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 09, 2012 02:31 AM by Mjlthuston
May 12, 2011 09:07 PM|LINK
I added a new ASP.NET Web Site (Razor) to a solution in VS2010. I believe the following code was created automatically by VS:
<link href="@Href("~/Styles/Site.css")" rel="stylesheet" />
It works fine. However, the Manage Styles window shows the error "File not found @Href(" instead of the styles in Site.css.
Could you anyone offer some tip to get around this?
Thanks in advance.
May 12, 2011 09:51 PM|LINK
<link href="/Styles/Site.css" rel="stylesheet" />
May 12, 2011 10:19 PM|LINK
Thanks for your response.
Now I get the error "File not found: ../Styles/Site.css" after following your suggestion.
May 13, 2011 09:15 AM|LINK
All you need to do is adjust the path to the CSS file in the <link href=""> attribute. The sample I supplied above is the proper syntax. Take note that using /Styles/Site.css will look for the Site.css file from the virtual root, and that using Styles/Site.css
will look for that path/file relative from the file you are using it in.
May 13, 2011 09:27 AM|LINK
Make sure your style sheet's path is correct.by default all the style sheets placed under 'Styles' folder.alternatively you can choose the path where you saved .
May 13, 2011 12:38 PM|LINK
I am sorry but I have just realized that my previous message must have been confusing. The error ""File not found: ../Styles/Site.css" was shown
only in the Manage Styles window.
The link, both previous and current version, has been working fine meaning the style sheet always works perfectly.
The issue is only with the Manage Styles window of VS.
I restarted VS, now the Manage styles widnows is completely empty. This makes me think that Manage Styles is not applicable to Razor files (i.e. .cshtml files). The Manage Styles window still works fine for .aspx files. It is only .cshtml files that have
May 13, 2011 06:19 PM|LINK
Yes view-> Manage styels window is not working if we use @Href or @Url.Content to include css file but it is working fine if we use <link href=... />
May 16, 2011 01:33 PM|LINK
In my case (VS2010 Ultimate), the Manage Styles window is still empty even if I use the following:
<link href="Styles/Site.css" rel="stylesheet" type="text/css" />
May 17, 2011 04:01 AM|LINK
According to your issue, you can have a look at these links.
Hope this can help you.
May 17, 2011 10:24 AM|LINK
Thanks for the links which have very useful information regarding css use.
Unfortunately they are not related to my issue - Manage Styles window not showing for cshtml pages.
At this point, I assume that the Manage Styles window of VS2010 does not support cshtml pages.