2015-10-16 65 views
0

我正在开发一个asp.net web应用程序使用web数据库的形式。在我的应用程序已存储的图像文件夹中,并为图片链接存储在数据库中 我希望通过采取这些链接从数据库 显示这些图片我尝试了以下代码来显示图像如何显示数据库所采取的链接图像

home.aspx的.cs

 protected void Page_Load(object sender, EventArgs e) 
    {  
     profile_picture = (string)(Session["link"]); //link has been taken from db 
    } 

home.aspx

<asp:Image runat="server" ID="profile_picture" ImageUrl="Label"></asp:Image> 

错误是=>错误4无法隐式转换类型 '字符串' 到 'System.Web.UI.WebControls.Image' 如何解决? 谢谢。

回答

0
profile_picture.ImageUrl = (string)(Session["link"]); 

这应该有所帮助。不知道如果ImageUrl是正确的属性,但看看System.Web.UI.WebControls.Image这是什么“profile_picture”是typeOf,看看图像链接应设置为什么属性。