在repeater中找不到Label
我在后台里写
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
{
Label labSignR = (Label)e.Item.FindControl("LabelSignRight");
Label labSignW = (Label)e.Item.FindControl("LabelSignWrong");
labSignR.Visible = false;
labSignW.Visible = false;
}
}
然后总是找不到,labSignR的值是null
为什么会这样呢???
------解决方案--------------------
检查Label名称是否拼写错误,还有你的Label是在ItemTemplate中的嘛???