内容不会出现在其他文件夹中的页面上。 [英] content doesnot appear on pages which are inside other folders.

查看:78
本文介绍了内容不会出现在其他文件夹中的页面上。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在母版页上创建了滑块,滑块的图像位于滑块图像文件夹中。我的默认页面在解决方案资源管理器中是裸的。所以滑块在那里工作正常。但我的关于我们页面位于新文件夹内,问题是滑块不会在关于我们页面上显示图像。任何人都可以帮助..

解决方案

尽管您的母版页位于根文件夹中,但它是在您正在查看的内容页面的上下文中执行的。所以这样的代码



 <   img     src   =   slider images / slider-86_3.jpg    alt   = 图片已损坏  /  >  





将在一个文件中工作root作为滑块图像也在root中,但是当你查看子文件夹中的页面时,你的网址现在已被破坏,因为该文件夹中没有滑块图像。使用ResolveUrl获取文件的正确路径,而不是硬编码。



 <   img     src   ='  <% = Page.ResolveUrl(< span class =code-string> 〜/ slider images / slider-86_3.jpg %> '    alt   = 图像已损坏  /   >  


I created slider on masterpage, the images of the slider are inside "slider images" folder. my default page is naked in the solution explorer. so the slider works fine there. but my "About US" page is inside new folder and the problem is the slider doesnot show images on the about us page. can anyone help please..

解决方案

Despite your master page being in the root folder it is executed in the context of the content page you are viewing. So code like this

<img src="slider images/slider-86_3.jpg" alt="Image is Broken"/>



will work in a file in root as "slider images" is in root also, but when you look at a page in a sub-folder your url is now broken as there is no "slider images" in that folder. Use ResolveUrl to get the proper paths to your files instead of hard-coding them.

<img src='<%=Page.ResolveUrl("~/slider images/slider-86_3.jpg")%>' alt="Image is Broken"/>


这篇关于内容不会出现在其他文件夹中的页面上。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆