This is a migrated thread and some comments may be shown as answers.
How to get data after filtering
1 Answer 22 Views
This is a migrated thread and some comments may be shown as answers.
Kirill Ugolnikov
Top achievements
Rank 1
Kirill Ugolnikov asked on 25 Aug 2008, 09:54 AM
Hello
I've had a RadGrid with pagining, filtering and custom aggrigate. How can I calculate values after filtering on all pages?

Regards

1 Answer, 1 is accepted

Sort by
0
Kirill Ugolnikov
Top achievements
Rank 1
answered on 26 Aug 2008, 06:42 AM
I was found this solution

protected void rgReport1_CustomAggregate(object sender, GridCustomAggregateEventArgs e)
    {
        CountOf1= 0;
        CountOf2 = 0;
        CountOf3 = 0;
        CountOf4 = 0;
        int nTotal = 0;

        RadGrid grid = (RadGrid)sender;
        DataTable table = (DataTable)grid.MasterTableView.DataSource;
        DataView view = new DataView(table);
        view.RowFilter = grid.MasterTableView.FilterExpression;
        foreach (DataRowView drItem in view)
        {
            switch ((string)drItem["Column1"])
            {
                case "Value1": CountOf1++; break;
                case "Value2": CountOf2++; break;
                case "Value3": CountOf3++; break;
                case "Value4": CountOf4++; break;
            }
            nTotal++;
        }

        e.Result = string.Format("<div style='text-align:left'>Total: {4} <br/> {0} <br/>  {1} <br/>  {2} <br/>  {3} </div>", CountOf1, CountOf2, CountOf3, CountOf4, nTotal);
    }

Tags
Grid
Asked by
Kirill Ugolnikov
Top achievements
Rank 1
Answers by
Kirill Ugolnikov
Top achievements
Rank 1
Share this question
or