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.
Unfortunately, activation email could not send to your email. Please try again.

GridGroupingControl

Thread ID:

Created:

Updated:

Platform:

Replies:

69894 Nov 15,2007 04:36 PM Nov 21,2007 10:20 AM Windows Forms 2
loading
Tags: Grouping
Prem
Asked On November 15, 2007 04:36 PM

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 07:01 AM

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 10:20 AM

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.

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.

;