I tried: AlternateText='<%# Eval("Common_Flag") %>' on my Image declaration, but with no luck. Yes, I tried Bind as well as Eval.
Also, it seems that I'm getting an unexpected first row at the top of by exported file. I had to change my code to apply the header formatting to the 2nd row.
Here's my current OnInfrastructureExporting event handler:
protected void grdControls_InfrastructureExporting(object sender, GridInfrastructureExportingEventArgs e)
var colCount = e.ExportStructure.Tables.Columns.Count;
// Set the header style for all columns
var headerStyle = new ExportStyle();
headerStyle.ForeColor = Color.White;
headerStyle.BackColor = Color.Blue;
headerStyle.Font.Bold = true;
var booleanHeaderStyle = new ExportStyle();
booleanHeaderStyle.ForeColor = Color.White;
booleanHeaderStyle.BackColor = Color.Blue;
booleanHeaderStyle.Font.Bold = true;
booleanHeaderStyle.HorizontalAlign = HorizontalAlign.Center;
var booleanColumnStyle = new ExportStyle();
booleanColumnStyle.HorizontalAlign = HorizontalAlign.Center;
for (var i = 1; i <= colCount; i++)
e.ExportStructure.Tables.Cells[i, 2].Style = headerStyle;
e.ExportStructure.Tables.Columns[i].Width = 300; // Would like auto-width !!
// Place an "X" in cells assigned to a boolean data field if value is true
var rowCount = e.ExportStructure.Tables.Rows.Count;
for (var c = 1; c <= colCount; c++)
var booleanColumn = false;
for (var r = 2; r <= rowCount; r++)
var cellValue = e.ExportStructure.Tables.Cells[c, r].Value.ToString();
var cellText = e.ExportStructure.Tables.Cells[c, r].Text.ToString();
System.Diagnostics.Debug.WriteLine("Cell Value: " + cellValue + " cellText: " + cellText);
if (cellValue == "True" || cellValue == "False")
booleanColumn = true;
e.ExportStructure.Tables.Cells[c, r].Value = (cellValue == "True") ? "X" : "";
e.ExportStructure.Tables.Cells[c, r].Style = booleanColumnStyle;
e.ExportStructure.Tables.Cells[c, 1].Style = booleanHeaderStyle; // Also center the header
e.ExportStructure.Tables.Columns[c].Width = 100;
I've also attached a screenshot of an exported file.
As you can see the image appears (the checkmark).
What am I doing wrong?
Also, what happened to your documentation. It seems that it's taken a turn for the worse. For example how do I easily find the OnInfrastructureExporting event doc?
Thanks for any suggestions as to how to proceed.