repeater 问题
在最后一行加个总计,中间根据不同种类有合计,所有数据都通过SQL算好了,合计没问题,最后一行的总计出不来,
protected void RpBook_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
Label lbl_biz = (Label)e.Item.FindControl("lbl_biz");
Label lbl_typename = (Label)e.Item.FindControl("lbl_typename");
Label lbl_saletypename = (Label)e.Item.FindControl("lbl_saletypename");
Label lbl_saletypecust = (Label)e.Item.FindControl("lbl_saletypecust");
Label lbl_salescore = (Label)e.Item.FindControl("lbl_salescore");
Label lbl_salejifen = (Label)e.Item.FindControl("lbl_salejifen");
Label lbl_branchname = (Label)e.Item.FindControl("lbl_branchname");
Label lbl_username = (Label)e.Item.FindControl("lbl_username");
Label lbl_sdate = (Label)e.Item.FindControl("lbl_sdate");
Label lbl_salebranch = (Label)e.Item.FindControl("lbl_salebranch");
Label lbl_saletypeid = (Label)e.Item.FindControl("lbl_saletypeid");
ImageButton im1 = (ImageButton)e.Item.FindControl("IBDelClass");
for (int i = 0; i<=RpBook.Items.Count-1; i++)
{
if (((Label)(RpBook.Items[i].FindControl("lbl_salebranch"))).Text == "")
{
((Label)(RpBook.Items[i].FindControl("lbl_biz"))).Text = "";
((Label)(RpBook.Items[i].FindControl("lbl_typename"))).Text = "";
((Label)(RpBook.Items[i].FindControl("lbl_saletypename"))).Text = "";
((Label)(RpBook.Items[i].FindControl("lbl_saletypecust"))).Text = "合 计";
((Label)(RpBook.Items[i].FindControl("lbl_salescore"))).Text = "----";
((Label)(RpBook.Items[i].FindControl("lbl_branchname"))).Text = "";
((Label)(RpBook.Items[i].FindControl("lbl_username"))).Text = "";
((Label)(RpBook.Items[i].FindControl("lbl_sdate"))).Text = "----";
}
}
/* if (((Label)(RpBook.Items[i].FindControl("lbl_salebranch"))).Text == "" && ((Label)(RpBook.Items[i].FindControl("lbl_saletypeid"))).Text == "")
{
((Label)(RpBook.Items[i].FindControl("lbl_biz"))).Text = "";
((Label)(RpBook.Items[i].FindControl("lbl_typename"))).Text = "";
((Label)(RpBook.Items[i].FindControl("lbl_saletypename"))).Text = "";
((Label)(RpBook.Items[i].FindControl("lbl_saletypecust"))).Text = "总 计:";
((Label)(RpBook.Items[i].FindControl("lbl_salescore"))).Text = "----";
((Label)(RpBook.Items[i].FindControl("lbl_branchname"))).Text = "";
((Label)(RpBook.Items[i].FindControl("lbl_username"))).Text = "";
((Label)(RpBook.Items[i].FindControl("lbl_sdate"))).Text = "----";
}
*/
}
if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem)
{
if (e.Item.ItemIndex == rows-1) //关于总计用了很多方法,都不行,现在是INDEX 是-1
{
((Label)(RpBook.Items[rows - 1].FindControl("lbl_biz"))).Text = "";
((Label)(RpBook.Items[rows - 1].FindControl("lbl_typename"))).Text = "";
((Label)(RpBook.Items[rows - 1].FindControl("lbl_saletypename"))).Text = "";
((Label)(RpBook.Items[rows - 1].FindControl("lbl_saletypecust"))).Text = "总 计:";
((Label)(RpBook.Items[rows - 1].FindControl("lbl_salescore"))).Text = "----";
((Label)(RpBook.Items[rows - 1].FindControl("lbl_branchname"))).Text = "";
((Label)(RpBook.Items[rows - 1].FindControl("lbl_username"))).Text = "";
((Label)(RpBook.Items[rows - 1].FindControl("lbl_sdate"))).Text = "----";
}
}