先设置showfooter属性为true 再写一下代码
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
// 合计
if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Cells[0].Text = "合计";
e.Row.Cells[1].Text = GridView1.Rows.Count.ToString()+"条数据";
}
}
时间: 2024-12-17 20:02:12