风萧雨瑟

成功在于坚持

导航

为Gridview控件添加一个合计列

在做审计局内部信息系统的时候,需要一个合计列,对数据进行统计

以下是添加合计列的方法,其实就是添加一个Footer列

 

 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
      
        if (e.Row.RowType == DataControlRowType.DataRow)
        {

            // totalstock += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "stockholdmarketprice"));
            // totalstock += DataBinder.Eval(e.Row.DataItem, "stockholdmarketprice");

           //在这里就可以实现总和的计算了

        }
       

        else if (e.Row.RowType == DataControlRowType.Footer )
        {
            huizong();
            e.Row.Cells[0].Text = "合计";
            其它依次的添加内容
            //  }
        }

posted on 2008-09-03 14:44  肖林海  阅读(866)  评论(0编辑  收藏  举报