I have a lot of RadGridViews inside my applications and as long as there are columns of type GridViewTextBoxColumn only I never encountered perfomance issues. Now I have to do some formatting (very simple logic in my opinion, see code below) and my RadGridView is much slower, especially scrolling.
I tried using CellFormatting and RowFormatting event (not the same time) but both events result in poor performance. Also I am wondering why the documentation recommends using CellFormatting instead of RowFormatting. I have to display 1000-10000 records with 15 columns. Isn't RowFormatting executed one time per (visible) row while CellFormatting will be executed 15 times per row?
Here is my RowFormatting code. Of course the code differs a little bit when I use it in CellFormatting but the idea is the same. All I want to do is set some Images:
// Check column "EventTypeID" and set corresponding icon in column "EventTypeImage"
var cell = row.Cells[
"EventTypeImage"
];
if
(cell !=
null
&& cell.Value ==
null
)
{
switch
((
byte
) row.Cells[
"EventTypeID"
].Value)
{
case
(
byte
) EEventType.Error:
{
cell.Value = Resources.ErrorIcon;
break
;
}
// other cases
}
}
// 4 more GridViewTextBoxColumns that I check and set corresponding icon in a GridViewImageColumn
Performance is good as long as there are few records. But beginning with 500+ rows I have to deal with big performance impacts. I also encountered some crazy behavior with CellFormatting. When I put a counter in my code and write this counter to console whenever CellFormatting event is raised the event never stops from raising so the application hangs forever. I don't know whats going on there, why is this event raising endless just because I write down some debug info to console?
I am using latest version of RadControls for WinForms Q3.