There is no instance of the image being replaced with the default image

  • 2020-05-30 19:47:53
  • OfStack

web. config:


<configuration>
  <appSettings>
    <add key="dmPic" value="bgImages/moren.jpg" />
  </appSettings>
</configuration>

Corresponding.cs page:



if (sdr.Read())
{
    this.lblDianMianMingCheng.Text = sdr["BuJuGongSiName"].ToString();
    DianMianId = sdr["BuJuID"].ToString();
    if (sdr["BuJuCarPhoto"].ToString() == "")
    {
        this.ImageDianMian.ImageUrl = ConfigurationManager.AppSettings["dmPic"].ToString();// The place of key 
    }
    else {
        this.ImageDianMian.ImageUrl = sdr["BuJuCarPhoto"].ToString();
    }             
}


Related articles: