lastbudget and lastactual are both Lists
These lists populate 2 columns in an infragistics ultragrid
- PrevFY
- Actual_c
So the grid has defined datasource already. These 2 columns I added programmaticly onto the grid which has a datasource.
(dgvBudget is the name of the ultragrid)
int rowIndex = dgvBudget.Rows.Count;
if (half == "Second Half Budget")
{
for (int i = 6; i < rowIndex; i++)
{
var row = dgvBudget.Rows[i];
row.Cells["PrevFY"].Value = lastbudget[i];
row.Cells["Actual_c"].Value = lastactual[i];
}
for (int i = 0; i < 6; i++)
{
var row = dgvBudget.Rows[i];
row.Cells["PrevFY"].Value = lastactual[i];
row.Cells["Actual_c"].Value = 0;
}
}
else
{
for (int i = 0; i < rowIndex; i++)
{
var row = dgvBudget.Rows[i];
row.Cells["PrevFY"].Value = lastbudget[i];
row.Cells["Actual_c"].Value = lastactual[i];
}
}
How could I write this to take less time? This works, but it is taking 8 seconds to fill the grid with the data. Any help would be appreciated!