Unplanned
Last Updated: 31 Oct 2019 11:45 by ADMIN
Orit
Created on: 31 Oct 2019 11:44
Category: Grid
Type: Bug Report
1
Hiding the filter row leaves an empty row in the produced Excel file
The problem happens when there is a visible insert row on the grid which gets replaced by an empty row in the exported Excel file. The temp solution is to clear the insert row with the code below and the empty row in the generated excel will be removed.

protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
    if(e.CommandName == RadGrid.ExportToExcelCommandName)
    {
        // if there are items in edit mode, clear those
        if(RadGrid1.EditIndexes.Count > 0)
        {
            RadGrid1.EditIndexes.Clear();
            RadGrid1.Rebind();
        }
            
        // if insert item is present, cancel the insert form
        if (RadGrid1.MasterTableView.IsItemInserted)
        {
            RadGrid1.MasterTableView.GetInsertItem().FireCommandEvent("Cancel", "");
        }       
    }
}

0 comments