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;
}

}

}
}

Parents
No Data
Reply
  • 12345
    Offline posted

    Hi selvi,

    This exception is likely happening due to the large amount of data being processed. There are a lot of rows and it appears that there are at least 12 columns, all with summaries. The best way to solve this issue is by reducing the amount of data that the application is working with.

    You can reduce the memory usage in your application by reducing the amount of data presented to the user. You might be able to perform the summaries on the backend and show the results, or pre-filter the data before showing it to the user if it is important for them to view individual data rows.

    Please let me know if you have any further questions.

Children