Approved
Last Updated: 18 Mar 2019 10:15 by ADMIN
ADMIN
Kostadin
Created on: 02 Nov 2015 13:21
Category: UI for ASP.NET AJAX
Type: Bug Report
0
When sort a grid with LightWeight render mode and export to Excel Biff format the sort expression is added to the header cells
Issue can be replicated using the following Grid settings:

  • Wire up the onCommand client-side event to the grid
  • Set the excel format to Biff
  • Set the RenderMode to Lightweight
  • Enable Sorting


<telerik:RadGrid ID="RadGrid2" runat="server" RenderMode="Lightweight" AllowSorting="true">
    <ExportSettings>
        <Excel Format="Biff" />
    </ExportSettings>
    <ClientSettings>
        <ClientEvents OnCommand="onCommand" />
    </ClientSettings>
    <MasterTableView AutoGenerateColumns="True" CommandItemDisplay="Top">
        <CommandItemSettings ShowExportToExcelButton="true" />
    </MasterTableView>
</telerik:RadGrid>
1 comment
ADMIN
Attila Antal
Posted on: 18 Mar 2019 10:07
This bug is still reproducible with 2019.1.215

Until this issue is being fixed, the following code could serve as a viable workaround:

protected void RadGrid1_PreRender(object sender, EventArgs e)
{
    if ((sender as RadGrid).IsExporting)
    {
        RadGrid grid = sender as RadGrid;
        GridHeaderItem headerItem = grid.MasterTableView.GetItems(GridItemType.Header)[0] as GridHeaderItem;
        foreach (GridColumn col in grid.MasterTableView.RenderColumns)
        {
            headerItem[col.UniqueName].Text = !string.IsNullOrEmpty(col.HeaderText) ? col.HeaderText : col.UniqueName;
        }
    }
}