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

Grid pager total count question

1 Answer 175 Views
Grid
This is a migrated thread and some comments may be shown as answers.
dean
Top achievements
Rank 1
dean asked on 13 Apr 2009, 07:18 PM

I have a question regarding the Asp.Net Grid. 

* I do not use an ObjectDataSource.
* I return a List<entityObject> from the web service using the underlying database to do my paging.  I.e., I request pages one at a time, say 25 rows, each row populates an entityObject.
* As part of each query, I add an int column/property on the entityObject called TotalListCount that is populated immediately following the query and returned to the web page as an ordinary property (I know, its redundant, but simple.).
*  Here is the question:  Can I set a Grid property so that the Pager "thinks" the total row count in the datasource is TotalListCount (not 25)?

FYI, to do this with the built-in grid, I had to subclass the GridView and override the InitializePager() event handler to set the pagedDataSource.VirtualCount to my custom count (i.e. TotalListCount).  This works fine, but I am looking to the Telerik Grid to help with upcoming in-grid editing scenarios.

Thanks, dstelow

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 16 Apr 2009, 10:33 AM
Hi Dean,

In RadGrid you can get entire row count in the ItemEvent as shown below.

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


Regards
Shinu.
Tags
Grid
Asked by
dean
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or