This is a migrated thread and some comments may be shown as answers.

Getting Total Item Count in Paging Grid

3 Answers 163 Views
Grid
This is a migrated thread and some comments may be shown as answers.
hamda
Top achievements
Rank 1
hamda asked on 15 Jun 2010, 10:10 AM
hello...

in radgrid I want to be able to get the overall count of the records returned from
my database query. When I use datagrid.Item.Count, it only returns the
count for the current page. I see a property that lists pagecount, but
nothing for totalcount. I want to have a label above my datagrid that
says "n results returned".

Can anyone help,
 thanks.

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 15 Jun 2010, 10:43 AM
Hello,

One easy method is temporarily disabling the paging, rebind the grid and retrieve the " Items.Count ". After getting the count, you can re-enable the paging for grid.


Regards,
Shinu.
0
Accepted
Daniel
Telerik team
answered on 15 Jun 2010, 12:09 PM
Hello Hamda,

Please try the following approach:
protected void RadGrid1_ItemEvent(object sender, GridItemEventArgs e)
{
    if (e.EventInfo is GridInitializePagerItem)
    {
        int rowCount = (e.EventInfo as GridInitializePagerItem).PagingManager.DataSourceCount;
    }
}

Regards,
Daniel
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
hamda
Top achievements
Rank 1
answered on 16 Jun 2010, 05:11 AM
thank you Daniel :) that was what I  need...
,
Shinu.. thanks to be here...
Tags
Grid
Asked by
hamda
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Daniel
Telerik team
hamda
Top achievements
Rank 1
Share this question
or