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

Accessing total item count of grid

2 Answers 65 Views
Grid
This is a migrated thread and some comments may be shown as answers.
KevinMc
Top achievements
Rank 1
KevinMc asked on 25 Sep 2008, 09:05 PM
Is there any way to get the total item count for a grid when using custom paging with the objectdatasource? I would like to update a label outside the grid with the total number of records returned by the query. The objectdatasource has the selectcount method which tells the grid total records. If anyone would tell me what event and property to use to access that count in either the objectdatasource or the radgrid so i could set the label that would be great.

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 26 Sep 2008, 03:57 AM
Hi KevinMc,

Give a try with the following code snippet and see whether it is helpful.

CS:
  protected void RadGrid1_ItemEvent(object sender, GridItemEventArgs e) 
    { 
        if (e.EventInfo is GridInitializePagerItem) 
        { 
            int allRowsCount = (e.EventInfo as GridInitializePagerItem).PagingManager.DataSourceCount; 
        } 
    } 



Thanks
Shinu.
0
KevinMc
Top achievements
Rank 1
answered on 26 Sep 2008, 04:36 PM
That was exactly what i needed!

Thanks!
Tags
Grid
Asked by
KevinMc
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
KevinMc
Top achievements
Rank 1
Share this question
or