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

GridGroupingControl

Thread ID:

Created:

Updated:

Platform:

Replies:

69894 Nov 15,2007 09:36 PM UTC Nov 21,2007 03:20 PM UTC WinForms 2
loading
Tags: Grouping
Prem
Asked On November 15, 2007 09:36 PM UTC

I have more than 2000 characters in a word document (multiple lines). I copy it and paste it into a string column in a grouping control grid and it seems to paste the data
across mulitple rows in the grid. Am I missing something?


Administrator [Syncfusion]
Replied On November 16, 2007 12:01 PM UTC

The paste support that you are seeing is inherited through GridControlBase (the TableControl property in the GridGroupingControl). This support pastes text using tabs to mark new columns and newlines to mark new rows (as if the text came from rows and columns in Excel). So, the newlines in your Doc text are being pasted across multiple rows in the TableControl.

One way to avoid this behavior is to handle the TableCOntrolCurrentCellKeyDown event and do the paste yourself there. Here is a little code showing how.


//subcribe to the event
this.gridGroupingControl1.TableControlCurrentCellKeyDown += new GridTableControlKeyEventHandler(gridGroupingControl1_TableControlCurrentCellKeyDown);

//the handler
void gridGroupingControl1_TableControlCurrentCellKeyDown(object sender, GridTableControlKeyEventArgs e)
{
if (e.Inner.Control && e.Inner.KeyCode == Keys.V)
{
if (e.TableControl.CurrentCell.IsEditing)
{
GridTextBoxCellRenderer renderer = e.TableControl.CurrentCell.Renderer as GridTextBoxCellRenderer;
if (renderer != null)
{
if (Clipboard.ContainsText())
{
string s = Clipboard.GetText();
renderer.TextBox.SelectedText = s;
e.Inner.Handled = true;
}
}
}
}
}




Prem
Replied On November 21, 2007 03:20 PM UTC

Thanks Clay.
That worked great.

Thanks again!!

Prem

>The paste support that you are seeing is inherited through GridControlBase (the TableControl property in the GridGroupingControl). This support pastes text using tabs to mark new columns and newlines to mark new rows (as if the text came from rows and columns in Excel). So, the newlines in your Doc text are being pasted across multiple rows in the TableControl.

One way to avoid this behavior is to handle the TableCOntrolCurrentCellKeyDown event and do the paste yourself there. Here is a little code showing how.


//subcribe to the event
this.gridGroupingControl1.TableControlCurrentCellKeyDown += new GridTableControlKeyEventHandler(gridGroupingControl1_TableControlCurrentCellKeyDown);

//the handler
void gridGroupingControl1_TableControlCurrentCellKeyDown(object sender, GridTableControlKeyEventArgs e)
{
if (e.Inner.Control && e.Inner.KeyCode == Keys.V)
{
if (e.TableControl.CurrentCell.IsEditing)
{
GridTextBoxCellRenderer renderer = e.TableControl.CurrentCell.Renderer as GridTextBoxCellRenderer;
if (renderer != null)
{
if (Clipboard.ContainsText())
{
string s = Clipboard.GetText();
renderer.TextBox.SelectedText = s;
e.Inner.Handled = true;
}
}
}
}
}






CONFIRMATION

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

;