Export to Excel

6 posts, 0 answers
  1. Eric Schoenholzer
    Eric Schoenholzer avatar
    138 posts
    Member since:
    Mar 2004

    Posted 24 Jun 2008 Link to this post

    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

  2. Veli
    Admin
    Veli avatar
    2002 posts

    Posted 27 Jun 2008 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Veli
    Admin
    Veli avatar
    2002 posts

    Posted 27 Jun 2008 Link to this post

    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
  5. Marek Svrcina
    Marek Svrcina avatar
    13 posts
    Member since:
    Feb 2008

    Posted 24 Feb 2009 Link to this post

    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)

     

  6. Daniel
    Admin
    Daniel avatar
    4943 posts

    Posted 24 Feb 2009 Link to this post

    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.
  7. itmanager@malibuboats.com
    itmanager@malibuboats.com avatar
    9 posts
    Member since:
    May 2008

    Posted 06 Apr 2009 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017