When I export my grid which contains some GridDropDownColumn to Excel, the DataField of the GridDropDownColumn is exported, and not the ListTextField.
Is it possible to change this behavior?
Thanks
Eric
5 Answers, 1 is accepted
Could you please set "ExportOnlyData" to true and see if the problem persists. Also try replacing the GridDropDownColumn by a GridTemplateColumn with a DropDownList in the EditItemTemplate, and see if the unwanted result is resolved.
Greetings,
Veli
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
I am attaching the sample project from your support ticket, so that it is publicly available. It is demonstrating correct behavior of RadGrid's GridDropDownColumn exporting its DataTextField value.
At the same time, we are currently investigating your case through the support ticket you have opened, and will follow up as soon as we identify the source of the problem.
Greetings,
Veli
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
I have same problem.
<telerik:GridDropDownColumn DataField="id_zeme" HeaderText="Zeme" ListDataMember="typZeme"
ListTextField="nazev_zeme" ListValueField="id_zeme" UniqueName="id_zeme">
</telerik:GridDropDownColumn>
p_RadGrid.ExportSettings.ExportOnlyData =
true;
p_RadGrid.ExportSettings.IgnorePaging =
true;
p_RadGrid.ExportSettings.OpenInNewWindow =
true;
p_RadGrid.ExportSettings.FileName =
p_Nazev;
This code is running in ASP. NET --> finish is ListTextField (I have version RadGrid_5_1_5_dev.exe)
no in ASP.NET AJAX --> finish is ListValueField (I have version RadControls_for_ASP.NET_AJAX_2008_3_1314_dev.exe)
Could you please modify the example, provided by Veli to help me reproduce the issue locally? You can send it attached to formal support ticket.
Thank you for your cooperation.
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.
This my mark up
<asp:Button ID="btnExport" runat="Server" OnClick="btnExport_Click" Text="Export" /> |
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false"> |
<MasterTableView> |
<NestedViewTemplate> |
<%# Eval("Notes") %> |
</NestedViewTemplate> |
<Columns> |
<telerik:GridEditCommandColumn UniqueName="EditColumn"> |
</telerik:GridEditCommandColumn> |
<telerik:GridBoundColumn DataField="ID" UniqueName="ID></telerik:GridBoundColumn> |
<telerik:GridBoundColumn DataField="Name" UniqueName="Name"></telerik:GridBoundColumn> |
</Columns> |
</MasterTableView> |
</telerik:RadGrid> |
Button Code
protected void btnExport_Click(object sender, EventArgs e) |
{ |
using (RadGrid g = uiVenderCreditApprovals) |
{ |
string bDate = uiBeginDate.SelectedDate.Value.ToShortDateString().Replace("/", "-"); |
string eDate = uiEndDate.SelectedDate.Value.ToShortDateString().Replace("/", "-"); |
string fileName = string.Format("{0}({1} to {2})", uiExportDataType.SelectedItem.Text, bDate, eDate); |
g.ExportSettings.FileName = fileName; |
g.ExportSettings.ExportOnlyData = true; |
g.ExportSettings.IgnorePaging = true; |
// remove nested view template which will remove the expand/colapse column |
g.MasterTableView.NestedViewTemplate = null; |
// hide the edit column |
g.MasterTableView.Columns.FindByUniqueName("EditCol").Visible = false; |
g.MasterTableView.ExportToExcel(); |
} |
} |
If you are using a the expand column and do not have a nexted view. Use the same method as the edit column.