某种形象的网址

时间:2013-02-21 03:27:24

标签: c# asp.net webforms

我有两行:

<img height="100" width="100" src="../uploadimages/18-2-2013-23-33-01-Lighthouse.jpg">

<asp:Image id="img_prev" name="img_prev" src="" Height="80" Width="100" runat="server" />
img_prev.ImageUrl = "../uploadimages/18-2-2013-23-33-01-Lighthouse.jpg"

我尝试在2 html图像和.net图像中显示图像,在html代码中显示商品,但在.net图像中它无法显示图像。

2 个答案:

答案 0 :(得分:2)

试试这个

<asp:Image id="Img1" runat="server" Height="80" Width="100" ImageUrl="../uploadimages/18-2-2013-23-33-01-Lighthouse.jpg" />

或删除src=""

答案 1 :(得分:0)

您是否有理由尝试使用asp图像控件?通常,如果您需要访问服务器端的控件,则只需要使用它。

试试这个。

img_prev.ImageUrl = "~/folder/filename";