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

how to export selected row only

2 Answers 32 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John Fussell
Top achievements
Rank 1
John Fussell asked on 29 Sep 2008, 01:36 PM
I have got ExportToCSV working, but it exports the whole grid.

Is it possible to export the selected row only?  If so, how?

Cheers.

2 Answers, 1 is accepted

Sort by
0
Accepted
Maria Ilieva
Telerik team
answered on 29 Sep 2008, 02:08 PM
Hi John,

You can try out the following code to export only the selected rows in the grid:

protected void Button1_Click(object sender, EventArgs e)  
    {  
        foreach (GridDataItem item in RadGrid1.Items)  
        {  
            if (item.Selected==false)  
            {  
                item.Visible = false;  
            }  
        }  
        RadGrid1.ExportSettings.ExportOnlyData = true;  
        RadGrid1.ExportSettings.OpenInNewWindow = true;  
        RadGrid1.MasterTableView.ExportToExcel();  
    }  
 
Let us know if this helps.


Kind regards,
Maria Ilieva
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
John Fussell
Top achievements
Rank 1
answered on 29 Sep 2008, 02:11 PM
It works perfectly!  Thank you.
Tags
Grid
Asked by
John Fussell
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
John Fussell
Top achievements
Rank 1
Share this question
or