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

I can display Total Item Count on footer. But I can't export that number to Excel.

0 Answers 81 Views
Grid
This is a migrated thread and some comments may be shown as answers.
LamKhoa
Top achievements
Rank 1
LamKhoa asked on 11 Jul 2012, 05:56 PM
Hi,

I used following code to get the total item count to display on the footer:

int RowCount;
protected void RadGrid1_ItemEvent(object sender, GridItemEventArgs e)
{
    if (e.EventInfo is GridInitializePagerItem)
    {
         RowCount = (e.EventInfo as GridInitializePagerItem).PagingManager.DataSourceCount;
    } 
}
  
  
protected void grd_ItemDataBound(object sender, GridItemEventArgs e)
 
    if (e.Item is GridFooterItem) //Set footer text  
    {
        RadGrid grd = (RadGrid)sender;
        GridFooterItem footerItem = e.Item as GridFooterItem;
        footerItem["LastCol"].Text = "Count: " + RowCount.ToString(); 
    }
}


However, when I export the grid to the Excel, the count is show as 0 in excel file (Count: 0).
Is there any workaround on this issue?

Thanks

Lamk.

No answers yet. Maybe you can help?

Tags
Grid
Asked by
LamKhoa
Top achievements
Rank 1
Share this question
or