9 Answers, 1 is accepted
Do you have latest version of Telerik.Web.UI?
Regards,
Vlad
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
You can use a Label control to export data from template columns:
<telerik:GridTemplateColumn UniqueName="Template1" HeaderText="Template1"> |
<ItemTemplate> |
<asp:Label ID="Label1" runat="server" Text='<%# Bind("CategoryName") %>'></asp:Label> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
Kind regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Regarding the export to CSV: Please make sure that ExportOnlyData is false in this case.
The file format error is mentioned in our documentation. I recommend you examine the following blog post:
"The file you are trying to open, '[filename]', is in a different format" Excel Error
Export to Microsoft Excel/Word/PDF/CSV
Please let us know if you need more information.
Kind regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I noticed that you are using RadControls for ASP.NET suite and not RadControls for ASP.NET AJAX as I thought. Exporting data from template columns is not supported in the current version of the mentioned controls. We will add the missing functionality for the Q1 2009 release which is expected at the end of February.
Kind regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Here is what my .aspx columns look like:
<ItemStyle HorizontalAlign="Center" />
<HeaderStyle HorizontalAlign="Center" />
<ItemTemplate>
<table>
<tr>
<td>
<asp:Image ID="image1" runat="server" AlternateText="Billed" ImageUrl="~/App_Themes/Default/TelerikControls/Grid/billed.gif" />
</td>
</tr>
</table>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn>
<HeaderTemplate>
<table>
<tr>
<td>
Mission No.
</td>
</tr>
<tr>
<td>
Mission Symbol
</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
Here is my C# code:
//Exports Billing Errors Log to Excel
protected void exportExcelButton_Click(object sender, ImageClickEventArgs e)
{
billingErrorsRadGrid.ExportSettings.IgnorePaging =
true;
billingErrorsRadGrid.ExportSettings.OpenInNewWindow =
true;
billingErrorsRadGrid.ExportSettings.ExportOnlyData =
true;
billingErrorsRadGrid.ExportSettings.FileName =
"Billing Errors Log2";
billingErrorsRadGrid.MasterTableView.ExportToCSV();
}
Any ideas how we can get all of the data into the .csv file?
I'm afraid that the provided code is not enough to get a clear picture about your scenario.
Neither the Image nor the alternate text can't be exported to CSV. Also the tables won't be rendered in this file format since it is very simple and doesn't support such layouts.
It is possible to customize the exported data (or replace the whole output with your data):
Protected Sub RadGrid1_GridExporting(ByVal source As Object, ByVal e As Telerik.Web.UI.GridExportingArgs) Handles RadGrid1.GridExporting |
Dim output As New StringBuilder() |
If (e.ExportType = ExportType.Csv) Then |
For Each hrow In RadGrid1.MasterTableView.GetItems(GridItemType.Header) |
'... build the output here |
Next |
For Each drow In RadGrid1.MasterTableView.Items |
'... build the output here |
Next |
e.ExportOutput = output.ToString() |
End If |
End Sub |
Best regards,
Daniel
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.