Hi,
I have a wingrid that allows users to copy from excel and paste it. I have a template add new row where the user paste (Ctrl+V) the data from excel. The problem is that after pasting the values (This happens without any problem) there are some additional rows that are getting added. Is there a way to avoid this unwanted rows to be added. It happens randomly., sometimes empty rows with default values gets added at row index 3 and sometimes at 2 and so on.
Any help is appreciated.
Thanks!
I've never heard of extra rows being added to the grid randomly while pasting. If that's happening, then it's either something in your code causing it or it's a pretty serious bug in the grid.
Can you duplicate this in a small sample project and post it here so we can check it out?
Mike,
Here is the sample project. Use an excel to copy paste into the grid. I have template add row which is getting added. Is there a way to negate ?
Also, enclosing the source code.
.exe -
Source Code -
I took a look at your sample, but I'm not sure what to do with this. The sample you attached here is handling the KeyDown event and added rows to the grid with you press Ctrl+V. So... if you don't want new rows to be added, you should remove the code that adds them.
I thought you were using AllowMultiCellOperation for this, and you are setting it to All, but it doesn't seem like this will even come into play because in order to do a Paste operation you would have to select a row (or rows) in the grid and you cannot do that in this sample since you have turned off the row selectors and clicking on a cell puts it into edit mode.
Also... I think the code you have here is blowing up. When I tried pasting multiple rows of data into a cell in the TemplateAddRow in your sample, I am getting Exceptions. Your code is in a Try...catch so maybe you are not seeing them, or maybe this has to do with the data I was using.
In any case, I'm not sure what your code in the KeyDown is event is trying to do, or why you are trying to do it, but it seems to be conflicting with the AllowMultiCellOperation functionality built-in to the grid.