如何在运行时显示图像? [英] How to display image at runtime?

查看:79
本文介绍了如何在运行时显示图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,

有人可以告诉我hoe在ASP.NET中在运行时显示图像吗?
我已经提供了图像的完整路径,但看起来似乎没有用.我在下面提供了我的代码段.你们中的任何一个可以帮助我吗?

Hello Friends,

Can anybody tell me hoe to display an image at runtime in ASP.NET?
I have provided the full path of the image but stil it doesnt seem to work. I have provided my code snippet below.Can any one of you help me in this?

if (strques.Contains(@"\"))
       {
           lbl_ques.Visible = false;
           Image1.Visible = true;
           Image1.ID = "image" + intcount;
           Image1.ImageUrl = strques;
       }



波形图包含的图像路径



whre strques contains the path of the image that is

E:\Swapnil\TestUSS22-1-2010

\QuizWebApp\Images\image_PuzzleMagicSQ\PuzzleMagicImgQuiz1-Q1.jpeg





which changes at runtime to give another puzzle.

推荐答案

如CG前面所述,您不应使用物理路径,请删除Server.MapPath,因为它提供了物理路径.
以以下格式给出路径:

As CG said earlier you should not use physical path, Remove Server.MapPath as it is giving the physical path.
Give path in this format:

Image1.ImageUrl = "~/Folder1/Folder2/image.jpg";


此处〜将指向应用程序的根文件夹.


here ~ will point to root folder of your application.


您应仅提供Web服务器内存在的路径,并且应使用相对于服务器根目录的路径.
You should provide only paths that exist within your web server, and you should use paths relative to the server root.


是的,我的Web浏览器中存在我的路径.拼图图像存储在image_PuzzleMagicSQ文件夹中.
Yes My path exists with my web browser..The puzzle images are stored in the image_PuzzleMagicSQ folder.


这篇关于如何在运行时显示图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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