protected void rptMessage_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
Label lblMessage = e.Item.FindControl("lblMessage") as Label;
string aa = lblMessage.ClientID.ToString();
}
}
不能直接e.item.findControl找到的时候就加一个判断
本文介绍了一个关于 ASP.NET 中 Repeater 控件的数据绑定技巧,具体讲解了如何在 ItemDataBound 事件中使用 if 语句来判断当前项的类型,并通过 FindControl 方法获取指定控件。
156

被折叠的 条评论
为什么被折叠?



