web.config:
复制代码代码如下:
<configuration>
<appSettings>
<add key="dmPic" value="bgImages/moren.jpg" />
</appSettings>
</configuration>
相应.cs页面:
复制代码代码如下:
if (sdr.Read())
{
this.lblDianMianMingCheng.Text = sdr["BuJuGongSiName"].ToString();
DianMianId = sdr["BuJuID"].ToString();
if (sdr["BuJuCarPhoto"].ToString() == "")
{
this.ImageDianMian.ImageUrl = ConfigurationManager.AppSettings["dmPic"].ToString();//重点之处
}
else {
this.ImageDianMian.ImageUrl = sdr["BuJuCarPhoto"].ToString();
}
}