c#代码上的ImageURL不显示图像

c#代码上的ImageURL不显示图像,c#,asp.net,image,visual-studio-2010,C#,Asp.net,Image,Visual Studio 2010,我在aspx页面上的图像为: <asp:Image ID="imgOrgLogo" runat="server" Width="50px" Height="35px" AlternateText="Image Not Found" /> 从字符串路径我得到图像名称 我检查了OrgImages文件夹是否包含指定的图像 但运行此代码后,不会查看图像 当我从浏览器中检查元素时,它显示: <img id="MainContent_imgOrgLogo" src="" alt=

我在aspx页面上的图像为:

<asp:Image ID="imgOrgLogo" runat="server" Width="50px" Height="35px" AlternateText="Image Not Found"  />
从字符串路径我得到图像名称

我检查了OrgImages文件夹是否包含指定的图像

但运行此代码后,不会查看图像

当我从浏览器中检查元素时,它显示:

   <img id="MainContent_imgOrgLogo" src="" alt="Image Not Found"

  style="height:35px;width:50px;">

这条路还没有定下来

我的代码有什么问题

请帮帮我。

试试:

<img id="MainContent_imgOrgLogo" src="" alt="Image Not Found" style="height:35px;width:50px;" runat="server" />
编辑:


但在选择时,它会改变图像

如果您想实现这一点,您应该将
更改为行

imgOrgLogo.ImageUrl = "/OrgImages/" + path;

移除

imgOrgLogo.DataBind();

在哪个事件中设置ImageUrl属性?ddlOrganization\u selectedIndexChanged在浏览器中查看生成的HTML代码。src属性是什么样子的?如我上面所示,先生:src是空白的,但在选择时它应该会更改图像…在这种情况下,它不会显示浏览器生成的图像的href属性的html。您的ImageUrl属性可能会被代码中的其他代码覆盖。删除imgorgogo.DataBind();它将与updatepanel一起工作
imgOrgLogo.ImageUrl = "/OrgImages/" + path;
imgOrgLogo.ImageUrl = "~/OrgImages/" + path;
imgOrgLogo.DataBind();