帮我看看这两处如何修改
private double sum = 0;//商品总数
int psum = 0;//商品数量
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowIndex >= 0)
{
sum = sum + Convert.ToDouble(e.Row.Cells[5].Text);//此字段为价格类型
psum = psum + Convert.ToInt32(e.Row.Cells[3].Text);//此字段为数字型int
}
else if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Cells[0].ColumnSpan = e.Row.Cells.Count;
e.Row.Cells[0].HorizontalAlign = HorizontalAlign.Right;
e.Row.Cells[0].Text = "总价格为:¥" + sum.ToString("0.00") + " 平均价格为:¥" + ((double)(sum / psum)).ToString();