如何将图像存储在图像变量中 [英] how can i store image in a image variable

查看:83
本文介绍了如何将图像存储在图像变量中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将.aspx页面中的图像存储在代码隐藏文件(aspx.cs)文件中的图像变量中

how can i store an image from .aspx page in a image variable in code behind file(aspx.cs) file

推荐答案

您需要设置属性名为 ImageUrl 以显示图像
you need to set the property named ImageUrl to show an image


使用ASP.NET图像控件



在aspx页面上,

Use ASP.NET Image Control

On aspx page,
<asp:image id="Image1" runat="server" ImageUrl="/images/abc.png"/>



For aspx.cs


For aspx.cs

string imagePath = Image1.ImageUrl;





您也可以获得该图像的其他属性:)



You can get other properties of that image too :)


试试这种方式



try this way

var img=System.Drawing.Image.FromFile("FILEPATH");


这篇关于如何将图像存储在图像变量中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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