有5个等级,是位于GridView的头一行 最左面的第一列是:“单位名称”在单位名称的最下面是“合计”功能
 
 现在要统计每列 的 等级个数!求助各位大哥,谢谢了,给点代码参考!

解决方案 »

  1.   

    GridView 用模板列的FooterTemplate
      

  2.   

    恩,楼上说的,在footerTemplate里面可以自定义的
    一般不用gv哦
      

  3.   

    FooterTemplate 比较好使,合并行太麻烦了
      

  4.   


    private double sum = 0;//取指定列的数据和,你要根据具体情况对待可能你要处理的是int
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            
            if (e.Row.RowIndex >= 0)
            {
                sum += Convert.ToDouble(e.Row.Cells[6].Text);
            }
            else if (e.Row.RowType == DataControlRowType.Footer)
            {
                e.Row.Cells[5].Text = "总薪水为:";
                e.Row.Cells[6].Text = sum.ToString();
                e.Row.Cells[3].Text = "平均薪水为:";
                e.Row.Cells[4].Text = ((int)(sum / GridView1.Rows.Count)).ToString();
                
            }
        }
    前台注明ShowFooter="True" 转自清清月儿GridView七十二绝技。
      

  5.   

    http://blog.csdn.net/21aspnet/archive/2007/03/25/1540301.aspx先看看资料吧
      

  6.   

    清清月儿GridView七十二绝技。