统计DataList 的某个列值等于1的记录
protected void DataList_Hu_ItemDataBound(object sender, DataListItemEventArgs e)
{
Label GuanXi_Name_H = (Label)e.Item.FindControl("lab_GuanXi_Name_H");
if (GuanXi_Name_H.Text == "户主")
iCount++;
}得到的iCount 不对,为什么
protected void DataList_Hu_ItemDataBound(object sender, DataListItemEventArgs e)
{
Label GuanXi_Name_H = (Label)e.Item.FindControl("lab_GuanXi_Name_H");
if (GuanXi_Name_H.Text == "户主")
iCount++;
}得到的iCount 不对,为什么
protected void DataList_Hu_ItemDataBound(object sender, DataListItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
{
Label GuanXi_Name_H = (Label)e.Item.FindControl("lab_GuanXi_Name_H");
if (GuanXi_Name_H.Text == "户主")
iCount++;
} }