在运行时加载图像. [英] Load image at run-time.

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

问题描述

大家好.

我是ASP.net的新手,正在学习它.我创建了一个页面,并在页面上放置了文件上传工具,图像控件和按钮.当我浏览图像并单击btn以在该图像控件上显示该图像时,它不起作用.

我在button_click事件中使用了以下代码:

Hi all.

I am new to ASP.net and learning it. I created a page and put a file upload tool, an image control and a button on page. When I browse an image and click on btn to show that image on that image control, it does not work.

I used the below code in button_click event :

if fileUpload1.HasFile then
imageControl.imageUrl=fileUpload1.PostedFile.FileName
end if



建议我该怎么办.

谢谢.

Gagan



suggest me what should I do.

Thanks.

Gagan

推荐答案

您需要将文件数据保存到服务器上的文件中,然后将ImageUrl指向该路径,而不仅仅是指向上传的文件的名称.
You need to save the file data to a file on the server, then point the ImageUrl to that path rather than just to the name of the file that was uploaded.


感谢您的回答.

因为我是asp.net的新手,所以请您详细说明您的答案.

谢谢.

Gagan
Thnks for your reply.

Will you please elaborate your answer because I am new to asp.net.

Thanks.

Gagan


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

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