创建一个全局变量
Public double Sumdb;
private void DataGrid1_ItemCreated(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
ListItemType lit=e.Item.ItemType;
if(lit==ListItemType.Footer)
{
TableCell tc1=e.Item.Cells[3];
TableCell tc2=e.Item.Cells[4];
TableCell tc3=e.Item.Cells[5];
TableCell tc4=e.Item.Cells[6];
Label L_xj=new Label();
L_xj.ID="lb_xj";
L_xj.;
L_xj.Text="合计";
tc1.Controls.Add(L_xj);
Label L_SumData=new Label();
L_SumData.ID="L_SumData";
L_SumData.;
L_SumData.Text=SumData();
tc2.Controls.Add(L_SumData);
Label L_zj=new Label();