Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
685
dataset clear performance with wingrid
posted

Hi, I have a large dataset, with many tables in binding with wingrid, there are 4 visible bands, other bands are hidden. When I do to clear the dataset, the time of clear instruction is 3,5 seconds, and I've see the the cause is binding with grid. There is a way to improve preformace in this scenario?

 thank you very much.

Andrea

  • 150
    posted

     Andrea,

    This behavior is well-known. Unfortunately, IG does not provide a way to truly suspend synchronization on the grid to let you call Clear() on your DataSet. I tried with Begin/EndUpdate(), Suspend/ResumeLayout() and Suspend/ResumeRowSynchronization() with no success (though the latter sounded promising on paper).

    The best solution I found and that is widely recommended for the .Net DataGrid also is to introduce a BindingSource between your actual data source (DataSet, DataTable, DataView, etc.) and the DataSource property of the WinGrid.

     Basically, instead of:

    ...
    ultraGrid1.DataSource = myDataSet.Table["TableName"];
    ...

    You would do this:

    ...
    BindingSource myBindingSource = new BindingSource();
    myBindingSource.DataSource = myDataSet.Table["TableName"];
    ultraGrid1.DataSource = myBindingSource;
    ...

    Most, if not all your code should work as-is, unless you were doing 'not recommended' direct interactions with the data source.

    Hope this helps.

    Regards,

    Eric. 

  • 469350
    Verified Answer
    Offline posted

    Hi Andrea,

        I can't see any reason why the grid should take so much time when you clear the DataSet. Unless the DataSet is sending a lot of unneccessary notifications or if you are clearing it in parts instead of all at once.

        What version of the grid do you have? Are you using the latest Hot Fix? 

        One thing you might try is using BeginUpdate/EndUpdate on the grid to prevent the grid from painting while you do the reset. I suspect that won't help much, though.