62,269
社区成员
发帖
与我相关
我的任务
分享<asp:DataList ID="dListProduct" OnItemDataBound="dListProduct_ItemDataBound" runat="server" Style="font-size: 13px"> protected void dListProduct_ItemDataBound(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
Label lblName1=e.Item.FindControl("lblName1") as Label;
Label lblName2=e.Item.FindControl("lblName2") as Label;
Label lblName=e.Item.FindControl("lblName") as Label;
lblName2.Visible=false;
lblName1.Visible=false;
}
}
foreach (RepeaterItem item in this.rptSerchHot.Items)
{
Label lbl1 = (Label)item.FindControl("lbl1");
Label lbl2 = (Label)item.FindControl("lbl2");
Label lbl3 = (Label)item.FindControl("lbl3");
}
}
找到了就可以做判断了。如if(条件){lbl1.visible=true;}