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

Export to Excel

5 Answers 257 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Eric Schoenholzer
Top achievements
Rank 2
Eric Schoenholzer asked on 24 Jun 2008, 10:06 PM

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

Sort by
0
Veli
Telerik team
answered on 27 Jun 2008, 10:35 AM
Hello EricSch,

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
0
Veli
Telerik team
answered on 27 Jun 2008, 10:50 AM
Hello EricSch,

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
0
Marek Svrcina
Top achievements
Rank 1
answered on 24 Feb 2009, 09:30 AM
Attached files - no running for this problem.
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)

 

0
Daniel
Telerik team
answered on 24 Feb 2009, 01:49 PM
Hello Marek,

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.
0
itmanager@malibuboats.com
Top achievements
Rank 1
answered on 06 Apr 2009, 05:03 PM
You can hide the column before exporting.  I have a rad grid and a button that exports to excel.  My grid has an edit column and an expand column.  To remove the edit column I gave that column a unique name so I can find it and just turn visiable to false.  The expand column was created because I have a nested view.  I set the nested view template to null and that took out the expanded column.  (This is done in the button event handler)

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.
Tags
Grid
Asked by
Eric Schoenholzer
Top achievements
Rank 2
Answers by
Veli
Telerik team
Marek Svrcina
Top achievements
Rank 1
Daniel
Telerik team
itmanager@malibuboats.com
Top achievements
Rank 1
Share this question
or