So I found a solution to this problem.
In your grid, use a GridBinaryImageColumn for the image.
<telerik:GridBinaryImageColumn
UniqueName="ImageColumnBin"
HeaderText="Image"
Exportable="true"
AlternateText="Image"
DefaultImageUrl="/images/Default.jpg" />
When you use this column, you can insert an image either from the client-side or server side. So when the grid renders on the page, I use an ajax call initiated from the Grids OnRowCreated client-side method.
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script>
OnRowCreated: function getBinaryImage(sender, args) {
var dataItem = args.get_gridDataItem();
var html = dataItem.get_cell("ImageColumnBin").innerHTML;
var jqhtml = $($.parseHTML(html.trim()));
var imgID = jqhtml.attr('id');
var pkey = args.getDataKeyValue('Key');
$.ajax({
type: 'POST',
url: 'ResultWindow.aspx/GetBinaryImage',
data: '{ImageKey: ' + pkey + '}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (r) {$('#' + imgID).attr('src', r.d);},
error: function (request, error) {console.log("Error: " + request);}
});
}
</script>
</telerik:RadCodeBlock>
So each time a row is created on the client side, this ajax call loads this images. If you have 500 records but are only displaying displaying 10 rows, you only need to load 10 images.
Now, we need these images in an export of this grid. On the server-side, in the ItemDataBound of the grid, check if the grid IsExporting. If this is true then we can assume that a user has kicked off the export. So for each item that is bound we can look up the image and assign it to the binary image column.
protected void RadGrid_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridDataItem && !e.Item.IsInEditMode)
{
GridDataItem dataBoundItem = e.Item as GridDataItem;
if (RadGrid.IsExporting
&& RadGrid.MasterTableView.GetColumnSafe("ImageColumnBin") != null
&& RadGrid.MasterTableView.GetColumnSafe("ImageColumnBin").Display)
{
(dataBoundItem["ImageColumnBin"].Controls[0] as RadBinaryImage).DataValue = GetBinaryImage(dataBoundItem.GetDataKeyValue("Key").ToString());
}
}
}
This solution worked best for me. Now I have Lazy-loaded images in my grid, and when I export this grid I have the full set of images.