0
我用这个代码和列值sGridView的页脚总使用LINQ
int total = 0;
protected void gvEmp_RowDataBound(object sender, GridViewRowEventArgs e)
{
if(e.Row.RowType==DataControlRowType.DataRow)
{
total += Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "Amount"));
}
if(e.Row.RowType==DataControlRowType.Footer)
{
Label lblamount = (Label)e.Row.FindControl("lblTotal");
lblamount.Text = total.ToString();
}
}
I'have更多的数据在我的数据库。所以我已经决定使用LINQ查询,低于
GridView1.Columns[8].FooterText = (from row in dt.AsEnumerable()
select row.Field<int>("amount")).Sum().ToString();
但我有寻呼在我的网格,页面大小为50,所以我要总结第1个共首先如果我点击第二页,然后我必须显示第二页总数。如何实现这一目标?
http://forums.asp.net/t/986566.aspx检查的最后答复。有了这个你应该弄明白。 – MajkeloDev 2014-12-13 11:45:21