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

CutPaste Problem

Hi All:

I have a problem to use GridControl.CutPaste.

In my program , I must write it a rule to Grid CutPaste , and unable user to copy outside data to paste in Grid .

If I set
Me.Model.CutPaste.ClipboardFlags = 0

And my CutPaste way can't working at the same time .

How can I do CutPaste in my way , and user cnt't Paste data to grid from otherwise .

Think for any help.

Best Regards,
Quenton.




3 Replies

JJ Jisha Joy Syncfusion Team September 25, 2008 09:39 AM UTC

Hi Quenton,


The method Model.CutPaste.Paste() will paste whatever data you got in the Clipboard. If you set Clipboard flags to 0, it will not allow pasting into cell.

Please let me know if you have any further questions.

Regards,
Jisha



AD Administrator Syncfusion Team September 25, 2008 12:20 PM UTC

Hi Jisha :

Thanks for your respond .

And my problem is how can I limit user using cut and paste "only" in Grid .

ex:
I write a button to let user can cut and paste data in grid .

And I wnat user can't cut data "form other place" to "paste into grid" .

Is any method can do that ?


By the way I have another question is :

The GridControl.ResizeColsBehavior can stop user to draw Grid Column width .

And how to limit only "1" Column can't draw ?


Best Regards,
Quenton.







JJ Jisha Joy Syncfusion Team September 26, 2008 06:33 AM UTC

Hi Quenton,

Issue 1:


This can be achieved by handling the PasteCellText event and canceling it. If you copy some text from Excel and paste it into the grid, then the PasteCellText event will be hit.

this.gridControl1.PasteCellText += new Syncfusion.Windows.Forms.Grid.GridPasteCellTextEventHandler(gridControl1_PasteCellText);


void gridControl1_PasteCellText(object sender, Syncfusion.Windows.Forms.Grid.GridPasteCellTextEventArgs e)
{

e.Cancel = true;
}

Issue 2:

If your intension is to prevent resizing of particular column, this can be achieved by handling the ResizingColumns event. Please refer the code:

this.gridControl1.ResizingColumns += new Syncfusion.Windows.Forms.Grid.GridResizingColumnsEventHandler(gridControl1_ResizingColumns);


void gridControl1_ResizingColumns(object sender, Syncfusion.Windows.Forms.Grid.GridResizingColumnsEventArgs e)
{

if (e.Columns.Left==2 )//Column2
e.Cancel = true;

}

Please try this and let me know if this helps.

Regards,
Jisha


Loader.
Live Chat Icon For mobile
Up arrow icon