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

Export To Excel Only Selected Rows

2 Answers 123 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chamira
Top achievements
Rank 1
Chamira asked on 22 Sep 2008, 04:48 PM
How can i export only the selected rows of  a grid ??

and when i exported a grid with a clientsideselecting column the checkboxes appear..
How can i avoid that..

Thanks in advance...

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 1
answered on 23 Sep 2008, 04:44 AM
Hello Chamira,

You can try out the following code to export only the selected rows in the grid and also to avoid exporting checkboxes, set the ExportSettings.ExportOnlyData property to true.
cs:
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(); 
    } 

Thanks
Princy.
0
Chamira
Top achievements
Rank 1
answered on 24 Sep 2008, 04:57 AM
thanks a lot princy.. it worked like a miracle..

da only thing i had to do was disable da visible property of the columns coz i had some template columns in there..

thanks
Tags
Grid
Asked by
Chamira
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Chamira
Top achievements
Rank 1
Share this question
or