Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net asp中继器数据绑定_.net_Asp.net_Repeater_Databound - Fatal编程技术网

.net asp中继器数据绑定

.net asp中继器数据绑定,.net,asp.net,repeater,databound,.net,Asp.net,Repeater,Databound,伙计们,asp repeater服务器控件上不存在数据绑定事件吗 我只想绑定我的所有数据,并在最后创建一个新的ItemTemplate并添加它,但就在所有数据绑定时,我使用它来计算集合中的总小时数。即使我将其放入页脚模板中,您也应该能够理解这一点 我使用它来计算集合中的总小时数。即使我将其放入页脚模板中,您也应该能够理解这一点 谢谢,如果(e.Item.ItemType==ListItemType.Footer):)这就是我需要的吗?谢谢,如果(e.Item.ItemType==ListIt

伙计们,asp repeater服务器控件上不存在数据绑定事件吗


我只想绑定我的所有数据,并在最后创建一个新的ItemTemplate并添加它,但就在所有数据绑定时,我使用它来计算集合中的总小时数。即使我将其放入
页脚模板中
,您也应该能够理解这一点


我使用它来计算集合中的总小时数。即使我将其放入
页脚模板中
,您也应该能够理解这一点


谢谢,如果(e.Item.ItemType==ListItemType.Footer):)这就是我需要的吗?谢谢,如果(e.Item.ItemType==ListItemType.Footer:)这就是我需要的吗
protected void rptRecords_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
    if (e.Item.ItemType == ListItemType.Footer)
    {
        int totalHours = 0;

        foreach (RepeaterItem item in ((Repeater)sender).Items)
        {
            Label lblRowHours = (Label)item.FindControl("lblHours");
            if (lblRowHours != null)
                totalHours += Convert.ToInt32(lblRowHours.Text);
        }

        ((Label)e.Item.FindControl("lblHoursTotal")).Text = totalHours.ToString();
    }
}