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

Copy and Paste

Hai, I using a griddatabound Gird ,when I copy a string from one column and paste that value to another cell which is of type int my application is crashing an dexception is coming as "Input string is not in a correct format" How can stop a user from pasting a string value into a cell of type int.

3 Replies

AD Administrator Syncfusion Team August 12, 2004 09:09 AM UTC

One way you can do this is to subscribe to the grid.Model.PasteCellText event. the event args will have the row and col and value being pasted. If you do not want it to be pasted (somehow decide whether it is an integer), set e.Cancel = true.


AR arvind August 12, 2004 10:36 AM UTC

How do u call the event >Hai, >I using a griddatabound Gird ,when I copy a string from one column and paste that value to another cell which is of type int my application is crashing an dexception is coming as >"Input string is not in a correct format" >How can stop a user from pasting a string value into a cell of type int.


AD Administrator Syncfusion Team August 12, 2004 10:59 AM UTC

You do not call the event. You subscribe to it, add your event handler, and then when the event is raised, your event handler code is hit. Normally, you never really call your code. Here is a sample that subscribes to the grid.Model.PasteCellText event. In the handler, the code checks if the values in column 2 are ints. If not, it does not allow the paste. GridDataBoundGridPasteCellText_6595.zip

Loader.
Live Chat Icon For mobile
Up arrow icon