I have infragesticgrid with (id,area,Eqname etc). I used infragestic grupuby functionlity on grid( eq-groupby Eqname). No I m exporting data from infragestic grid, as following-
for (int i = 0; i < grdCtrl.Grid.Rows.Count; i++) {
areaId = ProcessNull.GetInteger(dtObject.Select(primaryKey + "='" + grdCtrl.Grid.Rows[i].Cells[Eqname].Value.ToString() + "'")[0]["AreaID"].ToString());
grdCtrl.Grid.Rows[i].Cells["AreaPath"].Value
} grdCtrl.Grid.Ido_ExportToExcel();
But I got error - grdCtrl.Grid.Rows[i].Cells is Null.
If i add condition -
if (Grid.Rows[i].IsGroupByRow)
{ areaId = ProcessNull.GetInteger(dtObject.Select(primaryKey + "='" + grdCtrl.Grid.Rows[i].Cells[Eqname].Value.ToString() + "'")[0]["AreaID"].ToString());}
It never go inside conditon . How to resolve null problem i want to set areaid atleast for child rows.
Any idea?
thanks in advance
Thanks
Hi,
That's correct. MS Excel limits you to 8 levels of grouping, so you cannot export any more than that.
You could avoid the exception by setting OutlingStyle on the UltraGridExcelExporter.
Or you could reduce the complexity of your data - no human user could possibly deal with more than 8 levels of a hierarchy, anyway.
One other problem found while exporting, I have simple code for export-
if (saveFileDialog.FileName.EndsWith("xlsx")) ultraGridExcelExporter.Export(this, saveFileDialog.FileName, Infragistics.Documents.Excel.WorkbookFormat.Excel2007); else if (saveFileDialog.FileName.EndsWith("xls")) ultraGridExcelExporter.Export(this, saveFileDialog.FileName, Infragistics.Documents.Excel.WorkbookFormat.Excel97To2003);
If i group grid ( Grouping is more than 7 ) then i got error-
Exception Details:- Error Type: System.ArgumentOutOfRangeException- Error Description: Outline level must be between 0 and 7.Parameter name: valueActual value was 8.
thanks , its helpful to solved my problem.
If you group the grid using using OutlookGroupBy, then the grid rows at the root level will be UltraGridGroupByRows and the data rows with the cells are under those rows.
So if you want to loop through the data rows and ignore the GroupByRows, the easiest way to do that is like this:
foreach (UltraGridRow row in this.ultraGrid1.Rows.GetAllNonGroupByRows()) { }