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

Export only specific records

3 Answers 59 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Web Services
Top achievements
Rank 2
Web Services asked on 08 Dec 2011, 07:20 PM
I have a rad grid with a grid template column of checkboxes. Some are checked and some aren't, I do that in the code behind on the item data bound event. I have a button to export to excel but I need to export only the rows that aren't checked. I really don't even know where to start to do this. What would be the best way to go about this? Here's how I'm exporting right now.

Protected Sub export_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles export.Click
     RadGrid1.ExportSettings.OpenInNewWindow = True
     RadGrid1.ExportSettings.ExportOnlyData = True
     RadGrid1.ExportSettings.IgnorePaging = True
     RadGrid1.MasterTableView.ExportToExcel()
 End Sub

3 Answers, 1 is accepted

Sort by
0
Pablo
Top achievements
Rank 1
answered on 08 Dec 2011, 11:40 PM
If you filter your records (using the column filter in the checkbox column) and then export them to excel/pdf you would get the desire result 
0
Web Services
Top achievements
Rank 2
answered on 12 Dec 2011, 10:05 PM
I can't go that route, as I have to have a custom check box in there. Is there a way to loop through the columns on export and see if a specific item is checked and say "don't export this row"?
0
Web Services
Top achievements
Rank 2
answered on 12 Dec 2011, 11:58 PM
I ended up just creating another grid on the page but set visible to false and then databound that on the export click and then used that for my data. Probably not ideal, but it works.
Tags
Grid
Asked by
Web Services
Top achievements
Rank 2
Answers by
Pablo
Top achievements
Rank 1
Web Services
Top achievements
Rank 2
Share this question
or