Guys,
I am facing significant performance issues while using the conditional formatting objects like below.
If I do not format my grid it shows up really fast - using the conditional formatting it takes minutes to load.
The data amount I am loading is around 44000 records (7.500 in the Master, the rest in the childgrid).
Is there something I can do to optimize the performance? At the moment it is nearly unusable.
Here is the code I am referring to:
I am facing significant performance issues while using the conditional formatting objects like below.
If I do not format my grid it shows up really fast - using the conditional formatting it takes minutes to load.
The data amount I am loading is around 44000 records (7.500 in the Master, the rest in the childgrid).
Is there something I can do to optimize the performance? At the moment it is nearly unusable.
Here is the code I am referring to:
Dim
c1
As
New
ConditionalFormattingObject(
"ReferenceWeek0"
, ConditionTypes.Equal, _supplyLogicLayer.Mapping(0),
""
,
True
)
c1.RowBackColor = Color.FromArgb(79, 129, 189)
c1.CellBackColor = Color.FromArgb(79, 129, 189)
c1.CellForeColor = Color.White
c1.RowForeColor = Color.White
Dim
c5
As
New
ConditionalFormattingObject(
"Adjusted"
, ConditionTypes.Equal,
"Adjusted Net Requirement (User Input)"
,
""
,
True
)
c5.RowBackColor = Color.Orange
c5.CellBackColor = Color.Orange
c5.CellForeColor = Color.Black
Dim
c6
As
New
ConditionalFormattingObject(
"SupplyAdjusted"
, ConditionTypes.Equal,
"Supply Adj. Forecast (User Input)"
,
""
,
True
)
c6.RowBackColor = Color.Yellow
c6.CellBackColor = Color.Yellow
c6.CellForeColor = Color.Black
Dim
c2
As
New
ConditionalFormattingObject(
"KPI1"
, ConditionTypes.Equal,
"GREEN"
,
""
,
False
)
c2.RowBackColor = Color.FromArgb(97, 189, 122)
c2.CellBackColor = Color.FromArgb(97, 189, 122)
c2.CellForeColor = Color.FromArgb(97, 189, 122)
Dim
c3
As
New
ConditionalFormattingObject(
"KPI2"
, ConditionTypes.Equal,
"YELLOW"
,
""
,
False
)
c3.RowBackColor = Color.FromArgb(254, 221, 107)
c3.CellBackColor = Color.FromArgb(254, 221, 107)
c3.CellForeColor = Color.FromArgb(254, 221, 107)
Dim
c4
As
New
ConditionalFormattingObject(
"KPI4"
, ConditionTypes.Equal,
"RED"
,
""
,
False
)
c4.RowBackColor = Color.FromArgb(246, 150, 136)
c4.CellBackColor = Color.FromArgb(246, 150, 136)
c4.CellForeColor = Color.FromArgb(246, 150, 136)
grid.MasterGridViewTemplate.Columns(
"Measure"
).ConditionalFormattingObjectList.Add(c1)
grid.MasterGridViewTemplate.ChildGridViewTemplates(0).Columns(
"Measure"
).ConditionalFormattingObjectList.Add(c1)
grid.MasterGridViewTemplate.Columns(
"Measure"
).ConditionalFormattingObjectList.Add(c5)
grid.MasterGridViewTemplate.Columns(
"Measure"
).ConditionalFormattingObjectList.Add(c6)
For
Each
dc
As
GridViewDataColumn
In
grid.MasterGridViewTemplate.Columns
Select
Case
dc.FieldName
Case
"ZZMIN"
dc.Width = 70
dc.TextAlignment = ContentAlignment.MiddleCenter
dc.
ReadOnly
=
True
Case
"SourcePlant"
dc.TextAlignment = ContentAlignment.MiddleCenter
dc.Width = 70
dc.
ReadOnly
=
True
Case
"Plant"
dc.Width = 70
dc.
ReadOnly
=
True
Case
"Measure"
dc.Width = 210
dc.
ReadOnly
=
True
Case
"Material"
dc.TextAlignment = ContentAlignment.MiddleCenter
dc.Width = 70
dc.
ReadOnly
=
True
Case
Else
If
IsDate(dc.FieldName)
Then
'Format values
dc.FormatString =
"{0:####,##0}"
dc.Width = 70
dc.TextAlignment = ContentAlignment.MiddleRight
dc.
ReadOnly
=
False
'add conditional formatting for KPIs to each week column
dc.ConditionalFormattingObjectList.Add(c2)
dc.ConditionalFormattingObjectList.Add(c3)
dc.ConditionalFormattingObjectList.Add(c4)
End
If
End
Select
Next
'Format childgrid
For
Each
dc
As
GridViewDataColumn
In
grid.MasterGridViewTemplate.ChildGridViewTemplates(0).Columns
Select
Case
dc.FieldName
Case
"ZZMIN"
dc.TextAlignment = ContentAlignment.MiddleCenter
dc.
ReadOnly
=
True
Case
"SourcePlant"
dc.TextAlignment = ContentAlignment.MiddleCenter
dc.
ReadOnly
=
True
Case
"Plant"
dc.TextAlignment = ContentAlignment.MiddleCenter
dc.
ReadOnly
=
True
Case
"Measure"
dc.
ReadOnly
=
True
Case
"Material"
dc.TextAlignment = ContentAlignment.MiddleCenter
dc.
ReadOnly
=
True
Case
Else
If
IsDate(dc.FieldName)
Then
dc.FormatString =
"{0:####,##0}"
dc.TextAlignment = ContentAlignment.MiddleRight
dc.
ReadOnly
=
False
'add conditional formatting for KPIs to each week column
dc.ConditionalFormattingObjectList.Add(c2)
dc.ConditionalFormattingObjectList.Add(c3)
dc.ConditionalFormattingObjectList.Add(c4)
End
If
End
Select
Next
grid.MasterGridViewTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.None
grid.MultiSelect =
True