This is a migrated thread and some comments may be shown as answers.
get a summery of for filtered items
3 Answers 5 Views
This is a migrated thread and some comments may be shown as answers.
MOhammad
Top achievements
Rank 1
MOhammad asked on 05 Nov 2018, 12:35 PM
is there any way to get a summery of for the count of records from radgrid after filtering. 
see attached example for your reference. 

thank you 

3 Answers, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 07 Nov 2018, 06:52 PM
Hello Mohammad,

The Count Aggregate will give you that information. You can see more about in the following resources:

Here's also a very simple example I created for you:

<telerik:RadGrid runat="server" ID="rg1" OnNeedDataSource="rg1_NeedDataSource" AllowFilteringByColumn="true" ShowFooter="true">
    <MasterTableView>
        <Columns>
            <telerik:GridBoundColumn Aggregate="Count" FooterAggregateFormatString="total count of items: {0}" DataField="Id"></telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

and some dummy data to get it running:

protected DataTable GetDummyData()
{
    DataTable tbl = new DataTable();
    tbl.Columns.Add(new DataColumn("Id", typeof(decimal)));
    tbl.Columns.Add(new DataColumn("textField", typeof(string)));
    tbl.Columns.Add(new DataColumn("valueField", typeof(int)));
    tbl.Columns.Add(new DataColumn("fourthField", typeof(string)));
    tbl.Rows.Add(new object[] { 1, "one", 1, "red" });
    tbl.Rows.Add(new object[] { 1, "two", 2, "green" });
    tbl.Rows.Add(new object[] { 5, "three", 3, "blue" });
    tbl.Rows.Add(new object[] { 6, "four", 1, "pink" });
 
    return tbl;
}
 
protected void rg1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    (sender as RadGrid).DataSource = GetDummyData();
}


Regards,
Marin Bratanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
MOhammad
Top achievements
Rank 1
answered on 08 Nov 2018, 07:21 AM

thank you Marin,

an i use the Aggregate="Count" for specific value out of the box or i need to use the Aggregate="Custom" and write my own logic to count the different values?

0
Marin Bratanov
Telerik team
answered on 08 Nov 2018, 10:25 AM
The built-in count should suffice.
--Marin
Tags
Grid
Asked by
MOhammad
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
MOhammad
Top achievements
Rank 1
Share this question
or