listview的itemdatabond事件
此事件为何唯独找不到FileUpLoad控件啊?lb1没有问题,但是fulimg一直未null
static Label lb1;
FileUpload fulimg;
protected void gsindex_ItemDataBound(object sender, ListViewItemEventArgs e)
{
lb1 = e.Item.FindControl("pathslabel") as Label;
fulimg = e.Item.FindControl("imgup") as FileUpload;
if (fulimg == null)
{
this.Page.RegisterStartupScript("ss", "<script>alert('没找到')</script>");
return;
}
else
{
this.Page.RegisterStartupScript("ss", "<script>alert('找到了')</script>");
return;
}
}
[解决办法]
e.Item 调试这块看下控件集合有没有这个控件