ResolveURL和母版页 [英] ResolveURL and Master Pages
问题描述
大家好,
我在母版页中导入CSS文件时遇到问题。问题是ResolveURL在某些情况下在返回路径时无法正常工作。
例如,此代码在某些母版页中工作正常,在其他母版页中无法正常工作:
< link
href = " <%#
ResolveUrl(" App_Themes / Standard / Default.css") %> "
rel =" stylesheet"
类型 =" text / css"
/>
如果以上替换为
< 链接
href =" <%=
ResolveUrl(" App_Themes / Standard / Default.css" ;)%> "
rel =" stylesheet"
类型 =" text / css"
/>
然后呢仅在某些母版页中正常工作
有没有人在使用ResolveURL导入CSS和JS文件时遇到过这样的问题?是否有从主页导入这些文件的标准方法?
ResolveURL会将路径"relative"返回到"masterpage"。
您可以利用BaseURL作为解决问题的方法,请参阅:
http://aspnetresources.com/blog/linking_stylesheets_from_master_pages
<希望这有帮助......
请在 http://forums.asp上发布ASP.NET问题.net / 更快的回复。谢谢。
Hi all,
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?
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.
这篇关于ResolveURL和母版页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!