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?
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/.
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());
}
}