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
80
Rebinding of grid with custom collection on row addition/deletion
posted

Hi,

I am binding a List of custom object to a grid(lets call it source grid). I also have another grid (call it: destination grid) on my form, where the users will be able to drag drop the rows from the source grid.
I have been able to do all this, and add the custom object dropped on to the destination grid into the destination grid's List (datasource). I then bind this List again to the destination grid. Is this necessary? Is there no way that the grid automatically rebinds to the list, once it is changed. Or do I have to implement some inerface on the collection I am binding. Please help.
(Also to note:
I am doing some initialization on column formatting and stuffs on both grids but not on the layout event. I do them manually, once my first grid gets bound to the data. This is because, I rebind on every row addition/deletion to the destination grid, and this triggers the initialize layout, which disturbs the users formatting and also the initial formatting.)
I checked the entire knowledge base as well as the forums, and I didn't find this question before. If it has been posted, please point me to the correct thread/link.

Thank you,
Karthik

Parents
No Data
Reply
  • 69832
    Verified Answer
    Offline posted

    bkarthee said:
    Is there no way that the grid automatically rebinds to the list, once it is changed. Or do I have to implement some inerface on the collection I am binding.

    You basically answered your own question...the grid cannot "automatically rebind" to the list, because it needs to be notified about the change. One way to do this is to implement IBindingList, which exposes a 'ListChanged' event - UltraGrid subscribes to this event and reacts to the notifications accordingly.

Children