自定义控件读取web.config时,实例在设计时提示错误:“呈现控件时出错 发生了未处理的异常。未将对象引用设置到对象的实例”,部分代码如下:
private string _NO_Photo = System.Configuration.ConfigurationManager.AppSettings["photo"];#region html输出
protected override void RenderContents(HtmlTextWriter output)
{
output.Write(string.Format("<a href=\"{0}\" target=\"{1}\"><img src=\"{2}\" height=\"{3} \" border=\"0\" alt=\"{4}\" width=\"{5}\"></img></a>",
_NavigateUrl, Targer, ImageUrl, _height, _Alt, _width));
}
#endregion
private string _NO_Photo = System.Configuration.ConfigurationManager.AppSettings["photo"];#region html输出
protected override void RenderContents(HtmlTextWriter output)
{
output.Write(string.Format("<a href=\"{0}\" target=\"{1}\"><img src=\"{2}\" height=\"{3} \" border=\"0\" alt=\"{4}\" width=\"{5}\"></img></a>",
_NavigateUrl, Targer, ImageUrl, _height, _Alt, _width));
}
#endregion
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货