
protected
void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
if (this.reportProvider.HtmParams.ImageColumns.IsConfigColumn("TargetMet"))
{
if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
{
if (e.Item.DataItem != null)
{
DataRowView row = (DataRowView)e.Item.DataItem;
string sImg = ImageColumnHandler.GetImage(ImageColumnHandler.KPI_TARGET, System.Convert.ToDouble(row["TargetMet"]));
Image img = new Image();
img.ImageUrl =
this.Request.ApplicationPath + "/Images/" + sImg;
GridDataItem item = (GridDataItem)e.Item;
TableCell cell = item["TargetMet"];
cell.Controls.Clear();
cell.Controls.Add(img);
}
}
}
}
In Html it looks just wonderfull.
Pdf export fails to display the image. It just shows the value from the datasource.
How can I add images in codebehind to a RadGrid with autogenerate columns set to true in a way it is safe for pdf export?



.RadGrid_Sunset .rgRow td {border-color:#FFFFFF #FFFFFF #FFFFFF #CABAAB !important;}.RadGrid_Sunset .rgAltRow{background:none repeat scroll 0 0 #F1E9DC !important;}.RadGrid_Sunset .rgAltRow td {border-color:#F1E9DC #F1E9DC #F1E9DC #CABAAB !important;}.RadGrid_Sunset .rgRow {background: inherit !important;}.RadGrid_Sunset .rgRow td, .RadGrid_Sunset .rgAltRow td{border-left: solid 1px #CABAAB !important;padding-left: 7px !important;}/* finally, need to put this one back in */.RadGrid_Sunset .rgHeader:first-child, .RadGrid_Sunset th.rgResizeCol:first-child, .RadGrid_Sunset .rgFilterRow > td:first-child, .RadGrid_Sunset .rgRow > td:first-child, .RadGrid_Sunset .rgAltRow > td:first-child {border-left: 0 none !important;padding-left: 8px !important;}