My grid is bound to my data/business objects. All works well. I can add/remove/etc. I can even copy and paste a single cell value with no real problems. The UltraGrid updates my underlying business object property for the column that has been pasted into. Even when the column is bound to a list of objects using an UltraCombo I can copy a string to this column and that works too.
I was looking at the following issue but there was no real followups:
http://ko.infragistics.com/community/forums/p/45867/247538.aspx#247538
The problem I get when I try and paste to multiple cells - which a bound to a list of my business objects. I have 2 rows in the grid with existing data there. I have copied the following data from the table (2 rows, 2 columns):
When I select the same cells to paste into, I get the following error (I can see more information in the Error event):
Error performing Paste operation. Further information: Unable to convert the value 'SW 1 + SW 2' to the column's data type: Illegal data value Continue with the remaining cells?
All works fine when I paste the above one by one.
Why would a multi cell operation fail, but the single cell would work? Any ideas where I should look to help with this?
Thanks,
Andez
Hello,
From the description of your issue it seems that you have a field in your business class that is actually class and your classes are not marked as Serializable. When you copy/paste grid should serialize/deserialize values of the complex types in order to be able to perform correct copy/paste operations. I have attached simple sample where my business class contains complex type in its properties, my classes are marked as Serializable and you are able to perform copy/paste operations. If you comment “[Serializable]” you will get exception like this that you have describe.
Please let me know if you have any further questions or if I am missing something.
Hi Hristo,
My classes are marked as Serilizable - they were generated using nHydrate which is a thin layer on top of the Entity Framework.
I think it might be down to having 2 columns - where column 2 is dependant upon the selected item in column 1. Both columns are bound to different lists of business objects - so column 1 is bound to a list of BusinessObject1 and column 2 is bound to a list of BusinessObject2. These are selected in two different UltraCombo's.
But for my sake, I am copying valid data. I think the issue is that because the data for both columns comes from two different lists, I need to initialize them somewhere. At the minute I set the data source on my combos in BeforeCellListDropDown based on the e.Cell.Column.Key. All works well when I just edit the data myself.
So in Grid_InitializeLayout I set the following:
e.Layout.Bands(0).Columns("BusinessObject1").ValueList = BusinessObject1Combo
e.Layout.Bands(0).Columns("BusinessObject2").ValueList = BusinessObject2Combo
If I cause the UltraCombo's to be displayed, then the copy and paste works fine. I just want to copy and paste and for the appropriate list value to be selected.
Any more thoughts?
Thanks