-

解决方案 »

  1.   

    datagrid_ItemCreated()
    {
      if(e.Item.ItemType = ItemListType.Footer){
         Label lb = new Label();
         lb.ID = "lblTest";
         e.Item.Cell[0].Controls.Add(lb);
      }
    }datagrid_ItemDataBound(){
       if(e.Item.ItemType = ItemListType.Footer){
             Lable lb = e.Item.Cell[0].FindControl("lblTest") as Lable;
             if(lb != null) {
                    lb.Text = DataBinder.Eval(Container.DataItem,"PriceCount").ToString();
            }
        }
    }
      

  2.   

    楼上写的没有计算总分,我写下
    //以下作分数和的统计
    int count=0;
    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
    {
    count += int.Parse(ds.Tables[0].Rows[i]["Score"].ToString());
    }
    foreach(DataGridItem dgi in dgShow.Controls[0].Controls)
    {
    if (dgi.ItemType == ListItemType.Footer)
    dgi.Cells[6].Text = "总分:"+count.ToString();
    }