Completed
Last Updated: 01 Jun 2022 11:44 by ADMIN
Release R2 2022 SP1
Eric Moreau
Created on: 23 Jan 2019 18:24
Category: GridView
Type: Bug Report
3
RadGridView: Cannot export grid with GridViewComboBoxColumn inside a ColumnGroupsViewDefinition

Hi

I just found a strange issue using the latest bits of the Telerik RadGridView. 

I have a grid that contains ColumnGroupsViewDefinition. Inside one of the group, one of the column is a GridViewComboBoxColumn.

The grid shows correctly on the screen.

If I try to export it using GridViewSpreadExport, I get an exception saying "input string was not in a correct format".

The export works fine if:

-I don't have groups

-I export to HTML using ExportToHTML

-I export to HTML using ExportToCSV

 

Any help please?

4 comments
ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 02 Feb 2021 12:27

Hello, Mike,

As the status of this item indicates ("Unplanned"), a fix hasn't been introduced yet. Make sure that you cast your vote for the item in order to increase its priority. The more votes an item gathers the higher its priority becomes.

Please click the Follow button in order to get notified once the status of this item changes.

I hope this information helps.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

mike
Posted on: 02 Feb 2021 01:27
I'm experiencing the same exact issue.  Any chance of a fix for it?
Eric Moreau
Posted on: 24 Jan 2019 14:58
the workaround seems to be working for now
ADMIN
Dess | Tech Support Engineer, Principal
Posted on: 24 Jan 2019 11:38
Hello, Eric,      

Following the provided information I was able to replicate the error when RadGridView has a GridViewComboBoxColumn and a ColumnGroupsViewDefinition is applied. I have also attached my sample project for your reference. I confirm that this is an issue with the GridViewSpreadExport.

I have logged it in our feedback portal by making this thread public. You can track its progress, subscribe for status changes and add your comments to it. I have also updated your Telerik points.

Currently, the possible solution that I can suggest is to set the DisplayMember of the column to an empty string and thus export the ValueMember

SpreadExportRenderer exportRenderer = new SpreadExportRenderer();
GridViewComboBoxColumn comboColumn;
 
private void radButton1_Click(object sender, EventArgs e)
{
    comboColumn = this.radGridView1.Columns["CategoryID"] as GridViewComboBoxColumn;
    foreach (GridViewRowInfo row in this.radGridView1.Rows)
    {
        row.Cells["CategoryID"].Tag = comboColumn.GetLookupValue(row.Cells["CategoryID"].Value);
    }
     
    comboColumn.Tag = comboColumn.DisplayMember;
    comboColumn.DisplayMember = "";
     
    string fileName = @"..\..\export" + DateTime.Now.ToLongTimeString().Replace(":", "_") + ".xlsx";
    GridViewSpreadExport spreadExporter = new GridViewSpreadExport(this.radGridView1);
 
    spreadExporter.CellFormatting += spreadExporter_CellFormatting;
    spreadExporter.RunExport(fileName, exportRenderer);
    
    comboColumn.DisplayMember = comboColumn.Tag.ToString() ;
    comboColumn.Tag = null;
 
    Process.Start(fileName);
}
 
private void spreadExporter_CellFormatting(object sender, Telerik.WinControls.Export.CellFormattingEventArgs e)
{
    if (e.GridCellInfo != null && e.GridCellInfo.ColumnInfo != null && e.GridCellInfo.Tag != null && e.GridCellInfo.ColumnInfo.Name == "CategoryID")
    {
        exportRenderer.SetCellSelectionValue(e.GridCellInfo.Tag.ToString());
    }
}

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 
Attached Files: