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
1705
Implement copy and paste functionality with business objects
posted

Hey guys, 

 

I bound my grid to a list of objects ( List<BO> ) and I was wondering how I can implement copy and paste functionality so the grid copies and pastes a  record and the underlying object.

I can see it works great with cell data, but can it copy whole records and paste (add) objects in the underlying datasource?

 

I currently have several lines of code to accomplish this to work with Ctrl C and Ctrl V and cancel the BeforeMultiCellOperation event. However I'm running into some issues since I also would like to copy back and forth from Excel so I was wondering what's the best way to copy whole rows with an object list as the datasource.

 

Thanks !

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi,

    I'm not sure I understand the question, but the built-in support for copy and paste in the grid has to convert everything into strings and then it just fills in the cell in the grid with those strings just as though the user typed it in.

    If you have a cell in the grid that is an object, then the cell will display the ToString method of that object and the field will not be editable by the user. The grid would not know what to do if the user typed in a string into that field, since it would not know how to create an instance of the object or what other properties on the object would need to be set.

    So if you need to copy object instances from one cell to another, the grid can't really help you with that.

Children