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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid - Copy text

Thread ID:





21896 Nov 26,2004 05:56 AM UTC Nov 26,2004 07:18 AM UTC WinForms 1
Tags: GridControl
Kewalramani Kanchan
Asked On November 26, 2004 05:56 AM UTC

Hi, We are using Syncfusion grid version 1.6.8. It would be greatly appreciated if you could help in solving the below mentioned problems. 1. We have set Max Length property for grid cells. This works if the user enters data by typing into the grid but fails if the data greater than max length is pasted on a cell. 2. We have logic coded in CellKeyUp() to add a new row when user hits Enter Key on the last column of the grid. In one of the grids, the last column happens to be Amount column. Here if the user enters invalid value a message box gets displayed “Invalid amount entered.” If the user closes this message box by pressing the Enter Key, the logic on the CellKeyUp() event gets triggered and a new row gets added. Note: This happens only if ‘Tab’ key is used to leave the last cell with invalid value. Can it is possible that on click of any Modal form the CellKeyUp() event should not be triggered as the Enter key was not pressed for that Cell. 3. Another problem is if the copied data is multi-line text and user tries to paste the same within a cell, the application gives an error. Thanking in advance for your response and cooperation.

Administrator [Syncfusion]
Replied On November 26, 2004 07:18 AM UTC

I do not think you said what kind of grid you are using, but I assume it is a GridDataBoundGrid. 1) You will have to do this validation yourself. You can handle the grid.Model.ValidateCellText.
private void Model_PasteCellText(object sender, GridPasteCellTextEventArgs e)
	if(e.Text.Length > e.Style.MaxLength)
		e.Cancel = true;
		e.Abort = false;//continue other cell pastes
2) I think the simplest way to handle this would be to set a flag in your meesage box that displays the error message. Then in CellKeyUp, only execute the new row code if this flag is not set, and also reset the flag after you test. 3) By default, the grid interprets newlines from the clipboard as information to be added in a new row. So, it will not paste text with newlines in it into a single cell. If you want this behavior, then you will have to handle the entire paste yourself. You can do this by catch the grid.Model.ClipboardPaste event. You can also get an error if you paste at the bottom of a GridDataBoundGrid text that contains newlines if there is insufficient number of rows to how the pasted text with the newlines. You can handle this problem by adding additional lines in ClipboardPaste. Here is a forum link that discusses this.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon