'System.Web.UI.WebControls.Image' does not contain a
本文关键字:not does contain UI System Web WebControls Image | 更新日期: 2023-09-27 18:24:45
我试图从web服务获取图像,但遇到了一个错误
"System.Web.UI.WebControls.Image"不包含"FromStream"的定义我的代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
namespace SmartPoster
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// call web service here
SmartPosterV1 a = new SmartPosterV1();
MemoryStream mem = new MemoryStream(a.returnTestImage());
this.pictureBox1.Image = Image.FromStream(mem);
}
}
}
在ASP.Net中,您需要在Web窗体中具有System.Web.UI.WebControls.Image,并将要显示的图像的URL分配给ImageUrl属性。