悬赏园豆:20
[已关闭问题]
有16个repeater,都是根据一个判断确定是否显示一张图片,用的是一个literal控件这样lit_image.text="<img src=''/>";来显示图片.<br>这些repeater共用protected void Catelist_ItemDataBound(object sender, RepeaterItemEventArgs e)这一个方法来处理。<br> bool isChager = false;<br> string[] arrayItemIndex = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16" };<br> for (int i = 0; i < arrayItemIndex.Length; i++)<br> {<br> isChager = bool.Parse(((HiddenField)e.Item.FindControl("hf_Image" + arrayItemIndex[i])).Value);<br> if (isChager)<br> ((Literal)e.Item.FindControl("ltl_Image" + arrayItemIndex[i])).Text = "<img src='images/other/recomm_green.gif'/> <img src='images/other/recomm_gold.gif'/>";<br> else<br> ((Literal)e.Item.FindControl("ltl_Image" + arrayItemIndex[i])).Text = "<img src='images/other/recomm_green.gif'/>";<br> }<br>这样就出问题了。提示未将对象引用设置到对象的实例。<br><br>我也觉得这样的方法可能有问题,希望高手指教下~<br>