asp:图像不显示 [英] asp:image doesn't display
问题描述
大家好,
我尝试向Google寻求帮助并搜索该论坛,但还没有弄清楚...启动调试器(编译)时,我无法弄清楚为什么我的图像横幅没有显示并在本地运行...图像代码如下:
Hi guys,
I have try''d to google some help and search this forum, but havn''t figured it out yet... I can''t figure why my image banner doesn''t display, when I start Debugger (compile) and run it local...The image code is as following:
<asp:image id="Image2" runat="server" imageurl="~/App_Data/avatar.png" alternatetext="Error!"/>
</asp:image>
它显示在表格行中,换句话说,它应该已经显示在表格行中:)
希望有更多经验的人可以在这里帮助我:)
最好的问候
解决方案:
我在解决方案中添加了一个图像文件夹,但是为了显示图像,我必须在URL中添加〜.
Its shown in a tabel row, or in other words, it should have been shown in a tabel row :)
Hope that some with a little more experience can help me out here :)
Best Regards
Solution:
I added a image folder to my solution, but for getting the image shown, I had to add the ~ to the URL.
推荐答案
已使用server.Map路径用于图像路径...?
尝试使用以下标签
Have you using server.Map path for the image path ... ?
try with the following tag
<asp:Image ID="Image1" runat="server" ImageUrl="~/icons/globe1.JPG" />
<img src="icons/globe1.JPG" />
问候
koolprasad2003:)
regards
koolprasad2003 :)
我所做的只是使用拖放工具asp:image,我的图像位于Web应用程序文件夹中,名称为"App_Data".
回答#1,尝试您的建议,但无法正常工作.甚至没有img标签.
All I did was using the Drag&Drop tools asp:image, and my image is located in Web application folder named: "App_Data".
Answer #1, try''d your suggestions, but couldn''t get it to work. Not even the img tag.
如果您没有发布答案,请不要按"answer".编辑您的帖子以添加细节.
您需要考虑进行一些实际的编码,而不是使用拖放. App_data不是存储图像的好地方.另外,当您按F5键时,我认为这对b/c无效,内置Web服务器会将Web根目录设置得太高.您最好使用相对路径(删除〜)
Please don''t push ''answer'' if you''re not posting the answer. Edit your post to add detail.
You need to consider doing some actual coding, not using drag and drop. App_data is not a good place to store your images. Also, when you push F5, I don''t think this will work b/c the built in web server places the web root one level too high. You''re better off using relative paths ( remove the ~ )
这篇关于asp:图像不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!