150
Out of memory exception in Ultra grid binding
posted

Hi All,

We are trying to load 436000 rows data in Ultra Grid with grouping and Sum done on few columns and it throws an out of memory exception .Can you please let me know is there anyway we can fix this?

Please find below the code we are using for binding data and for Layout settings.

GRID.DataSource = null;

GRID.DataSource = dt;

GRIDInitializeLayout((UltraGridDisplayLayout)grdTaxBaseDetails.DisplayLayout);

//Definition for GRIDInitializeLayout

private void GRIDInitializeLayout(UltraGridDisplayLayout e_Layout)

{


if (GRID.Rows.Count > 0)
{

if (e_Layout.Bands[0].Groups.Count == 0)
{
var sortedColumns = grdTaxBaseDetails.DisplayLayout.Bands[0].SortedColumns;
if (e_Layout.Bands[0].Columns.Exists("Column1") == true && !sortedColumns.Contains("Column1"))
{

sortedColumns.Add("Column1", false, true);
e_Layout.Bands[0].Columns["Column1"].CellActivation = Activation.NoEdit;
}
}

if (e_Layout.Bands[0].Summaries.Count == 0)
{

if (e_Layout.Bands[0].Columns.Exists("Column2") == true)
{
e_Layout.Bands[0].Summaries.Add(SummaryType.Sum, e_Layout.Bands[0].Columns["Column2"]);
e_Layout.Bands[0].Columns["Column2"].CellActivation = Activation.NoEdit;
}
if (e_Layout.Bands[0].Columns.Exists("Column3") == true)
{
e_Layout.Bands[0].Summaries.Add(SummaryType.Sum, e_Layout.Bands[0].Columns["Column3"]);
e_Layout.Bands[0].Columns["Column3"].CellActivation = Activation.NoEdit;
}
if (e_Layout.Bands[0].Columns.Exists("Column4") == true)
{
e_Layout.Bands[0].Summaries.Add(SummaryType.Sum, e_Layout.Bands[0].Columns["Column4"]);
e_Layout.Bands[0].Columns["Column4"].CellActivation = Activation.NoEdit;
}
if (e_Layout.Bands[0].Columns.Exists("Column5") == true)
{
e_Layout.Bands[0].Summaries.Add(SummaryType.Sum, e_Layout.Bands[0].Columns["Column5"]);
e_Layout.Bands[0].Columns["Column5"].CellActivation = Activation.NoEdit;
}
if (e_Layout.Bands[0].Columns.Exists("Column6") == true)
{
e_Layout.Bands[0].Summaries.Add(SummaryType.Sum, e_Layout.Bands[0].Columns["Column6"]);
e_Layout.Bands[0].Columns["Column6"].CellActivation = Activation.NoEdit;
}
if (e_Layout.Bands[0].Columns.Exists("Column7") == true)
{
e_Layout.Bands[0].Summaries.Add(SummaryType.Sum, e_Layout.Bands[0].Columns["Column7"]);
e_Layout.Bands[0].Columns["Column7"].CellActivation = Activation.NoEdit;
}
if (e_Layout.Bands[0].Columns.Exists("Column8") == true)
{
e_Layout.Bands[0].Summaries.Add(SummaryType.Sum, e_Layout.Bands[0].Columns["Column8"]);
e_Layout.Bands[0].Columns["Column8"].CellActivation = Activation.NoEdit;
}
if (e_Layout.Bands[0].Columns.Exists("Column9") == true)
{
e_Layout.Bands[0].Summaries.Add(SummaryType.Sum, e_Layout.Bands[0].Columns["Column9"]);
e_Layout.Bands[0].Columns["Column9"].CellActivation = Activation.NoEdit;
}

if (e_Layout.Bands[0].Columns.Exists("Column10") == true)
{
e_Layout.Bands[0].Summaries.Add(SummaryType.Sum, e_Layout.Bands[0].Columns["Column10"]);
e_Layout.Bands[0].Columns["Column10"].CellActivation = Activation.NoEdit;
}
if (e_Layout.Bands[0].Columns.Exists("Column11") == true)
{
e_Layout.Bands[0].Summaries.Add(SummaryType.Sum, e_Layout.Bands[0].Columns["Column11"]);
e_Layout.Bands[0].Columns["Column11"].CellActivation = Activation.NoEdit;
}
if (e_Layout.Bands[0].Columns.Exists("Column12") == true)
{
e_Layout.Bands[0].Summaries.Add(SummaryType.Sum, e_Layout.Bands[0].Columns["Column12"]);
e_Layout.Bands[0].Columns["Column12"].CellActivation = Activation.NoEdit;
}

}

}
}