Hi
In Ultragrid i have issue when i click on export excel,
there are 2 Events
1) Button click event for Export to Excel
2) Begin Export to make some columns visible after Exporting.
so here is my detailed scenario:
when i make my all columns hidden false in Begin_Export method throws object reference error in
ExcelExporter.Export(ugMappingGrid, location);,in the btnExportoExcel_Click.
If i comment these two lines
// e.Layout.Bands[0].Columns["MyColumn1"].Hidden = false;
// e.Layout.Bands[0].Columns["MyColumn2"].Hidden = false;
in Begin_Export it works fine.
private void ExcelExporter_BeginExport(object sender, Infragistics.Win.UltraWinGrid.ExcelExport.BeginExportEventArgs e)
{
e.Layout.Bands[0].Columns["MyColumn1"].Hidden = false;
e.Layout.Bands[0].Columns["MyColumn2"].Hidden = false;
}
private void btnExportoExcel_Click(object sender, EventArgs e)
string location = string.Empty;
SaveFileDialog saveDialog = new SaveFileDialog();
saveDialog.Filter = "(*.xls)|*.xls";
saveDialog.DefaultExt = ".xls";
saveDialog.ShowDialog();
location = saveDialog.FileName;
if (saveDialog.FileName != "")
ExcelExporter.Export(ugMappingGrid, location); // Object reference error thows at this place
I got a fix for this issue, i just tried to show all columns in export button click event rather than showing in the begin_Export event that works fine right now, even in near future we will try to upgrade with newer version.
Thanks
Srivasta S
srivasta said:We can upgrade our version in development environment but we can't do that in all client location who are all using Infragistics v9.2 is there any other alternate way to fix this problem without upgrade.
I don't understand what you mean by this. Any possible solution would require you to rebuild your executable and update your client machines. So why can't you update the assemblies on those client machines, as well?
It might be possible for you to work around the issue in your exe, but since i don't know exactly what the issue is, I cannot say if this is possible or how to do it. The simplest way to fix it is to try to service release. Have you tried it on your machine to see if it fixes the issue?
I think this is probably a bug in the Infragistics assemblies, because I vaguely remember a bug like this coming up and being fixed. But there's really not enough information here for me to be sure that this is the same issue.
If you can post a small sample project demonstrating the exception, I could try it with the latest SR and some older versions and see if I can narrow it down. But in all likelihood, you will need to just download the service release.
Totally i have 28 columns having data in few columns & some may not have too, in that 15 are visible in the grid, but while exporting to excel i need to show 22 columns, if i make any column visible in begin_Export event, i will get Object reference error in the method ExcelExporter.Export(ugMappingGrid, location)
We can upgrade our version in development environment but we can't do that in all client location who are all using Infragistics v9.2 is there any other alternate way to fix this problem without upgrade.
Hi,
How many columns do you have in the grid? Are there only 2?
My guess is that this is a bug that was fixed a long time ago and you just need to update to the latest service release.
How to get the latest service release - Infragistics Community