gridview中具有分页和过滤的列的总和。 [英] Sum of a column in gridview with paging and filtering.

查看:68
本文介绍了gridview中具有分页和过滤的列的总和。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



decimal total = 0;
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        total += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "calc"));
    }
    lblTotal.Text = total.ToString();
}





我的尝试:



我正在使用当前页面的总和(我正在使用分页和过滤)。我想要所有gridview的总和,当我过滤我的gridview时,我也希望更新。



What I have tried:

I am taking the sum of current page with this (I am using paging and filtering). I want all my gridview's sum and when I am filtering my gridview I want that updated too.

推荐答案

请阅读我对该问题的评论。



对于初学者,我建议你阅读:

教程25:通过大量数据进行有效分页 [ ^ ]

如何:对DataGrid控件中的数据进行分组,排序和筛选 [ ^ ]
Please, read my comment to the question.

For starters i'd recommend to read this:
Tutorial 25: Efficiently Paging Through Large Amounts of Data[^]
How to: Group, Sort, and Filter Data in the DataGrid Control[^]


这篇关于gridview中具有分页和过滤的列的总和。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆