I have a Grid with Link Columns.
When I export to Excel, all the data appears in the excel file except the data in the columns that are Links.
I have these Settings :
Me.ExportSettings.ExportOnlyData = True
Me.ExportSettings.IgnorePaging = True
Me.ExportSettings.OpenInNewWindow = False
Is this related to ExportOnlyData being True ?
If so, How can I export the data without showing the Filters in the Excel file even if ExportOnlyData = False ?
7 Answers, 1 is accepted
0
Hello Joseph,
I recommend you leave ExportOnlyData as false and hide the unwanted elements in the event handler of your export button.
Let us know whether this helps.
Regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I recommend you leave ExportOnlyData as false and hide the unwanted elements in the event handler of your export button.
protected void exportButton1_Click(object sender, EventArgs e) |
{ |
foreach (GridFilteringItem item in RadGrid1.MasterTableView.GetItems(GridItemType.FilteringItem)) |
item.Visible = false; |
RadGrid1.MasterTableView.ExportToExcel(); |
} |
Let us know whether this helps.
Regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Shinu
Top achievements
Rank 2
answered on 02 Dec 2008, 05:45 AM
Hi Joseph,
You can also set the AllowFilteringByColumn property to false in the export button's click event to prevent the filtering item from appearing in the Exported document.
Shinu.
You can also set the AllowFilteringByColumn property to false in the export button's click event to prevent the filtering item from appearing in the Exported document.
protected void LinkButton1_Click(object sender, EventArgs e) |
{ |
RadGrid1.AllowFilteringByColumn = false; |
RadGrid1.Rebind(); |
RadGrid1.MasterTableView.ExportToExcel(); |
} |
Shinu.
0
Joseph
Top achievements
Rank 1
answered on 02 Dec 2008, 08:38 AM
Both solutions worked well.
But in the first column I have checkboxe + LINK
The checkboxes get exported too and the generated excel contains these checboxes.
Is there a way to hide these checkboxes ?
0
Joseph
Top achievements
Rank 1
answered on 02 Dec 2008, 09:03 AM
I am using this code :
Dim grid As gvAccess.Web.Controls.TelerikControls.Grid.GVWebGrid = Nothing
grid = Me._tableView.OwnerGrid
grid.AllowFilteringByColumn = False
For Each item As GridItem In grid.MasterTableView.GetItems(GridItemType.Item)
Dim chk As CheckBox = item.FindControl("CheckBoxSelect")
If chk IsNot Nothing Then
chk.Visible = False
End If
Next
grid.Rebind()
grid.DefaultExport()
All Checkboxes are still visible!
0
Accepted
Princy
Top achievements
Rank 2
answered on 02 Dec 2008, 09:08 AM
Hello Joseph,
A suggestion would be to hide the column containing the checkbox and the linkbutton and instead display a column containing linkbutton and then finally export the grid. You can go through the section 'Exporting GridButtonColumn/GridTemplateColumn/GridHyperLinkColumn data' in the following help link for more details on the same.
Exporting tips and tricks
Thanks
Princy.
A suggestion would be to hide the column containing the checkbox and the linkbutton and instead display a column containing linkbutton and then finally export the grid. You can go through the section 'Exporting GridButtonColumn/GridTemplateColumn/GridHyperLinkColumn data' in the following help link for more details on the same.
Exporting tips and tricks
Thanks
Princy.
0
Hello Joseph,
Try the following modification:
Let us know if you need further assistance.
Best regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Try the following modification:
grid.AllowFilteringByColumn = False |
grid.Rebind() |
For Each item As GridItem In grid.MasterTableView.GetItems(GridItemType.Item) |
Dim chk As CheckBox = item.FindControl("CheckBoxSelect") |
If chk IsNot Nothing Then |
chk.Visible = False |
End If |
Next |
grid.DefaultExport() |
Let us know if you need further assistance.
Best regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Joseph
Top achievements
Rank 1
answered on 02 Dec 2008, 10:55 AM
Thanks for your suggestions guys.
Hiding and showing columns was the appropriate solution.
Keep up the good work!