I am having issues with importing CSS files within my master page. The issue is ResolveURL does not work properly in returning paths in some cases.
For example, this code works fine in some master pages and does not work properly in other master pages:
<link href="<%# ResolveUrl("App_Themes/Standard/Default.css") %>" rel="stylesheet" type="text/css" />
If the above is replaced with
<link href="<%= ResolveUrl("App_Themes/Standard/Default.css") %>" rel="stylesheet" type="text/css" />
then it works fine only in some master pages
Has anyone encountered such issues in importing CSS and JS files using ResolveURL? Is there a standard way to import these files from master pages?
- Moved by Alan_chen Thursday, August 05, 2010 2:47 AM off topic (From:Visual C# General)
ResolveURL will return the path "relative" to the "masterpage".
you can utilize BaseURL as a workaround for your problem, please refer: http://aspnetresources.com/blog/linking_stylesheets_from_master_pages
Hope this helps...
Please post ASP.NET questions at http://forums.asp.net/ for faster responses. Thanks.
Best Regards, SK *** Please mark as Answer, if this reply helps you***
- Proposed as answer by Suresh Subramanian Friday, July 30, 2010 2:13 PM
Welcome to MSDN forum!
Here is a link shows how to import master page.
I often drag the .css files in the solution files to .aspx pages. It will automatically generate the code like:
<link href="Library/CSS/MasterPageStyle.css" rel="stylesheet" type="text/css" />
Hope these helps, if you have any problems, please feel free to let me know.
Please remember to mark the replies as answers if they help and unmark them if they provide no help