Exporting to xlsx also export GridEditCommandColumn but should not

2 posts, 0 answers
  1. Veronique
    Veronique avatar
    19 posts
    Member since:
    Jul 2011

    Posted 22 Aug Link to this post

    Until recently I was exporting to Excel using ExcelML format.  The GridEditCommandColumn was not exported (ExportOnlyData is set to true).
    I am now exporting using XLSX format.  Since then, the GridEditCommandColumn is exported along with data.
    I would expect the same behaviour (no edit column). 

    Is it a bug ? 
    Is there an option to hide GridEditCommandColumn when exporting to xlsx ?

    <telerik:RadButton ID="ButtonExportExcelML" runat="server" Text="Export to ExcelML" OnClick="ButtonExportExcelML_Click" />   
    <telerik:RadButton ID="ButtonExportXLSX" runat="server" Text="Export to XLSX" OnClick="ButtonExportXLSX_Click" />   
    <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="true" ExportSettings-ExportOnlyData="true" OnNeedDataSource="RadGrid1_NeedDataSource">
                <telerik:GridEditCommandColumn ButtonType="ImageButton" />


    protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        RadGrid1.DataSource = new List<int> { 1,2,3,4,5,6};
    protected void ButtonExportExcelML_Click(object sender, EventArgs e)
        RadGrid1.ExportSettings.FileName = "TestExcelML";
        RadGrid1.ExportSettings.Excel.Format = GridExcelExportFormat.ExcelML;
    protected void ButtonExportXLSX_Click(object sender, EventArgs e)
        RadGrid1.ExportSettings.FileName = "TestXlsx";
        RadGrid1.ExportSettings.Excel.Format = GridExcelExportFormat.Xlsx;



  2. Viktor Tachev
    Viktor Tachev avatar
    1445 posts

    Posted 24 Aug Link to this post


    To prevent the column from being exported you can set the Exportable property for it to false.

    <telerik:GridEditCommandColumn ButtonType="ImageButton" Exportable="false" />

    Viktor Tachev
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. DevCraft R3 2016 release webinar banner
Back to Top