Home Forums WinForms controls Xceed Grid for WinForms Adding values to the grid is VERY slow

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #15488 |

    first i populate a datatable from the database, the add records to the grid. its the adding the values to the grid which slow it down hugely. the 2 lines I have commented out will make this code run in about 25% of the time compared to with those 2 lines. Why does actually adding the values to the grid in this way take so long?
    At the moment, this grid is performing very baldy indeed, but I assume I am doing something wrong!
    Please Help!!!!!!!

    foreach(Data.Row data_row in data_table.Rows)
    {
    Xceed.Grid.DataRow row = gridFixtures.DataRows.AddNew();
    row.EndEdit();

    foreach (Xceed.Grid.DataCell cell in row.Cells)
    {
    try
    {
    object val = data_row[cell.FieldName];
    // try { cell.Value = val == DBNull.Value ? null : val; }
    // catch { cell.Value = Convert.ChangeType(val, cell.ParentColumn.DataType); }
    cell.DoubleClick += new EventHandler(cell_DoubleClick);
    _row_filter.AddFilterItem(cell.FieldName, cell.Value);
    }
    catch (Exception err)
    {
    cell.ErrorDescription = err.Message;
    }
    }
    }

    Imported from legacy forums. Posted by Phil (had 2387 views)

    User (Old forums)
    Member
    Post count: 23064

    Hi, I work with phish_100.

    I would like to add we are using:
    – Xceed Grid version 3.6
    – .Net Framework 2
    – Visual Studio 2005
    – Windows XP Professional

    I had used the Xceed Grid at my previous company, and so recommended it. However, I have found it to be a lot slower than I remember.

    We are using it solely in unbound mode, due to the amount of custom processing required.

    I have tried using various techniques to speed it up, eg: BeginUpdate/EndUpdate.

    The code you see above is what we have stripped it down to, to identify the source of the speed issues. It seems to be setting the cell.Vale.

    Imported from legacy forums. Posted by inter8ection (had 218 views)

    User (Old forums)
    Member
    Post count: 23064

    Indeed, setting .Value on every cell will be slower than it was before, not a whole lot, but if you have a very big load of rows, it can have a hit on performance. This is due to the new mechanics implemented to support cell virtualization, and shutting it off will not change this.

    However, this would not happen on a bound grid, that is, the mechanics to fill the grid is a bit different when bound to a data source, which means the grid will perform well, event better than previous versions, when virtualization is turned on.

    So the question is, why do you need an unbound grid? Is it absolutely necessary? Usually, an unbound grid is not intended for large DataRow sets, and in your case, it must be quite large since you see the difference in speed.

    A solution would be to create an in-between source and bind the grid to it. For example, an ArrayList or whatever, populate it with data from your DataTable, and bind the grid to this ArrayList.

    Then you should see the performance gain.

    Imported from legacy forums. Posted by André (had 3650 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.