I currently have an UltraGrid with an AddRow consisting of a number of columns, including some which are basic text columns.
When a user chooses to paste non-text clipboard information into the cell using CTRL+V, a new row is automatically created.
What is the easiest way to prevent this?
I've tried several different things, and have been unable to come up with a solution.
Currently, the only thing I can think of would be to create a custom editor, and override the paste method to prevent the paste. However, I can't believe that there is not an easier solution than this...
Thanks
Well, you could trap the BeforeMultiCellOperation event of the grid. Perhaps you can use that even to examine the clipboard data and see if it's valid for pasting into the cell, and if not, cancel it. I'm not sure how you would go about doing that, though, or what criteria you would use to validate the data.
This is probably something that needs to be fixed in the control itself.
Yes, sorry. The user is activating a text cell, and pasting via CTRL+V within the TemplateAddRow.
For instance, copying a file and then attempting to paste into the text cell within a TemplateAddRow will result in a new row being created. Even though there is no value to the text cell which was just pasted to.
Are there any possible workarounds for this, or is it simply behavior I'll have to live with for now?
Hi,
I'm not sure I understand. Why would pasting into the grid create a new row? Do you mean that the user is pasting into the TemplateAddRow?
You say the data is non-text, but what exactly do you mean. Is the paste operation writing any values to any of the cells in the row? If any cell in the row is changed, then the row is considered dirty and a new row ill get created. If nothing in the clipboard is valid for the row and there is no data written into the row and a new row is still being created, I think that's probably a bug.