We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Validate user paste into cell . .

i have successfully validated all user keypress by using the Grid_CurrentCellValidateString event, but that doesn''t stop someone from copying and pasting a bad value into the cell. Is there anyone please to validate this paste operation or do i have to put this code in the Grid_CurrentCellValidating event . . -ak

1 Reply

AD Administrator Syncfusion Team December 17, 2005 10:02 AM UTC

If you are pasting text (for example, this is always the case in a GridDataBoundGrid or is the case when you in a GridControl when you copy from another object like an Excel spreadsheet), then you can use the grid.Model.PasteCellText event to validate the text being pasted. But if you are copy from a GridControl and paste in a GridControl, then by default style objects are copied and pasted, and PasteCellText is not raised. In this case, you can either turn off support for copying styles (allowing only text to be pasted and PasteCellText to be hit) or you can handle the grid.ClipboardPaste. In ClipboardPaste, you would have to get the GridData object from the clipboard, validate it somehow. Working with PasteCellText is much simpler as it provides the proposed text cell by cell. To turn off style copy/paste support in a gridcontrol, turn off this flag. this.gridControl1.Model.CutPaste.ClipboardFlags &= ~GridDragDropFlags.Styles;

Loader.
Live Chat Icon For mobile
Up arrow icon