GridView求和求平均值

时间:2009-03-26    点击:1834   

ShowFooter="True"

<FooterStyle BackColor="#cccccc" />

    private double sum = 0;

    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {

        if (e.Row.RowIndex >= 0)
        {
            sum += Convert.ToDouble(e.Row.Cells[3].Text);
        }
        else if (e.Row.RowType == DataControlRowType.Footer)
        {
            e.Row.Cells[2].Text = "总:";
            e.Row.Cells[3].Text = sum.ToString();
            e.Row.Cells[0].Text = "平均:";
            e.Row.Cells[1].Text = ((int)(sum / GridView1.Rows.Count)).ToString();
        }


    }

演示 下载

用ASP实现远程批量文件改名
asp利用Stream读取显示文件
asp计算下载一个文件需要多长时间
GridView属性
GridView支持分页的自动编号
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 All Rights Reserved