I want to set background color for the exported cell in pdf document using OnRowExported event. Kindly provide the code sample regarding this.
Hello,
Thank you for contacting Infragistics!
We received your support request concerning changing the cell color on export, and this case has been assigned to me. I have done an initial review of your case and instead of using RowExported you will want to use CellExported event, please see the following forum thread:
http://ko.infragistics.com/community/forums/t/54580.aspx
Please let me know if you have any further questions concerning this matter.
hi mike,
I have a scenario to set cell color in rowExported Event based on certain condition and i have perform database interactions in rowExported Event.i have already reviewed your forum code for setting color in cellExpoted event. but it was not applicable to my scenario. if i plan to do setting color in cellExported event then i need to do database interation on each cell exported event and so that i can't set color to cells in cell exportedevent.
I had tried the below code but it is not working.Kindly suggest the code sample for setting color for cell in row exported event for webdatagrid 14.1.
protected void Grd_DocExporter_RowExported(object sender, DocumentRowExportedEventArgs e)
{
if (e.GridRow.Items[0].Value.ToString() == "NO")
e.GridRow.Items[0].CssClass = "redColorCssClass";
}
Thank you for the update. If you want to do it that way you will instead have to apply it in the RowExporting instead of the RowExported, for example:
protected void WebDocumentExporter1_RowExporting(object sender, DocumentRowExportingEventArgs e) { if (e.GridRow != null) { e.GridRow.Items[0].CssClass = "cssClass"; } }
The reason for this is the way you are doing it is applying it to the grid then exporting it. When using RowExported you the row has already exported so applying it to the grid then is too late.
Mike,
Css Class file is not working in RowExporting Event with the help of CellExported event I have found solution. The below code is working fine for me. Kindly suggest it is correct one.
protected void WebDocumentExporter1_CellExported(object sender, Infragistics.Web.UI.GridControls.DocumentCellExportedEventArgs e) { if (e.GridCell.CssClass == "cssClass")
e.ReportCellElement.Background = new Background(new Infragistics.Documents.Reports.Graphics.Color(System.Drawing.Color.Red));
How is your CSS class setup? It should be setup something like the following:
.cssClass > tr > td { background-color:blue; }
I am attaching my sample. Note that I had to delete the ig_res folder and bin folder to be able to attach it to the forums.