我正在从数据库中检索包括图像链接的数据,同时将图像源分配给返回的链接并运行它,图像不显示,在页面源中绘制链接后图像源中存在但不显示。当我给它的源静态提供它的罚款和在Firefox中也一切正常
那是我的代码 HTML
<img runat="server" id="image1" src="/images/carNumberArbil.png" alt="Alternate Text" />
C#
var data=(from ads in databaseManager.Ads
where ads.AdId.Equals(AdId)
select new {
AdId=ads.AdId,
Title=ads.Title,
Price=ads.Price,
City=ads.Cities.Name,
Category=ads.SubCategories.Categories.Name,
SubCategory=ads.SubCategories.Name,
Description=ads.Description,
PublishedDate=ads.PublishedDate ,
Image1=ads.Image1,
Image2=ads.Image2,
Image3=ads.Image3,
Image4=ads.Image4,
Image5=ads.Image5
}
).First();
this.image1.Src =data.Image1 == null ? "AdImages/AdDefault.png" : "AdImages/" + data.Image1.Substring(0, 7) + data.AdId + "[1]" + data.Image1.Substring(7);