设属性
protected void GridView1_RowDataBound1(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DataRowView myrows = (DataRowView)e.Row.DataItem;
mysum1 += Convert.ToDouble(myrows[3].ToString());
mysum2 += Convert.ToDouble(myrows[4].ToString());
mysum3 += Convert.ToDouble(myrows[5].ToString());
mysum4 += Convert.ToDouble(myrows[6].ToString());
mysum5 += Convert.ToDouble(myrows[7].ToString());
}
// 合计
if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Cells[0].Text = "合计";
e.Row.Cells[4].Text = mysum1.ToString();
e.Row.Cells[5].Text = mysum2.ToString();
e.Row.Cells[6].Text = mysum3.ToString("2f");
e.Row.Cells[7].Text = mysum4.ToString();
e.Row.Cells[8].Text = mysum5.ToString();
}
}