开发者

Master page- references to other files

I've got a master page in ASP.NET which references various other content such as javascript and CSS files. These are currently not in <asp: tags, they're in regular HTML. How can I make these references relative to whatever content page is being loaded such that they wor开发者_Go百科k regardless of where the content page is located within the server? The other similar questions were specific to tags which have <asp: equivalents or SharePoint.


This is how I do it:

<script type="text/javascript" src="<%=ResolveUrl("~/lib/jquery.address.js")%>"></script>
<link rel="stylesheet" media="screen" type="text/css" href="<%=ResolveUrl("~/fancybox/jquery.fancybox-1.3.4.css")%>" />

This way, it doesn't matter where the master page is located.

Side point, as I'm sure you know, a url() in a css file is evaluated relative to the css file. So when I have css files located beside their master template, any related images folders go there, too.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜