In the RadGrid_itemDataBound event I add an image and CssClass to a column depending on the dataItem returned.
However, when I export to Excel, Word, or PDF it throws an error (listed below).
How can I show an image and css in my grid and allow it to export without blowing up on the image or cssClass?
Grid Code Behind in ItemDataBound
Export Code
Error!!!
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
However, when I export to Excel, Word, or PDF it throws an error (listed below).
How can I show an image and css in my grid and allow it to export without blowing up on the image or cssClass?
Grid Code Behind in ItemDataBound
message.Text = Convert.ToString(dataItem["ERROR_MESSAGE"].Text); |
imageMessage.Text = Convert.ToString(dataItem["ERROR_MESSAGE"].Text); |
imageResults.Visible = true; |
message.ManualClose = true; |
refreshStatus.CssClass = "colorRed"; |
imageResults.ImageUrl = "~/images/ResultError.gif"; |
Export Code
protected void ButtonExcel_Click(object sender, System.EventArgs e) |
{ |
ConfigureExport(); |
RadGrid Grid1 = (RadGrid)Page.Master.FindControl("Main").FindControl("RadGrid1"); |
Grid1.MasterTableView.ExportToExcel(); |
} |
public void ConfigureExport() |
{ |
RadGrid Grid1 = (RadGrid)Page.Master.FindControl("Main").FindControl("RadGrid1"); |
Grid1.ExportSettings.ExportOnlyData = true; |
Grid1.ExportSettings.IgnorePaging = true; |
Grid1.ExportSettings.OpenInNewWindow = true; |
} |
Error!!!
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
|