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

Cut operation

For one of the columns i have set Enabled property = false and readonly property = true. But one i perform a cut operation on the row the contents of this column also gets cut which is exactly i don''t want. I could not figure out why. Can you please help?

7 Replies

AD Administrator Syncfusion Team December 14, 2004 09:05 AM UTC

What version are you using? Using 2.1.0.9, and setting these properties, I am unable to cut this cell. this.gridControl1[2,4].Text = "1"; this.gridControl1[2,4].Enabled = false; this.gridControl1[2,4].ReadOnly = true;


AD Administrator Syncfusion Team December 14, 2004 09:10 AM UTC

I am using 2.1.0.9. The problem is I have two such columns whose enabled and readonly property have been set in those ways. But when i cut the contents of one column are not cut but the contents of other column are cut. I am not able to figure out why?


AD Administrator Syncfusion Team December 14, 2004 12:02 PM UTC

Are these special columns, or are both default TextBox columns? Can you post a sample project showing this pronblem, or tell us how to see it in one of our samples?


AD Administrator Syncfusion Team December 15, 2004 08:51 AM UTC

How do i submit a test application?


AD Administrator Syncfusion Team December 15, 2004 08:53 AM UTC

Ok if you set the enbaled property to false and readonly property to true the contents are not cut. Say these properties are set for column 2. Now i cut row 4 and paste the contents on row 5 then the contents of column 2 are also pasted. What i want is the column 2 should not be affected by the paste operation. It should have the value it had before paste was performed.


AD Administrator Syncfusion Team December 15, 2004 09:30 AM UTC

In a GridControl, the default copy/paste support uses styles if they are on the clipboard. Copying and pasting styles will overwrite readonly cells. If you do not want this, there are several ways to handle it. The simplest way is to only support text pasting instead of both style and text pasting. You can do this by turninging a flag in the clipboardflags property. this.gridControl1.CutPaste.ClipboardFlags &= ~GridDragDropFlags.Styles; If you do this, the paste will stop when it comes to a readonly cell. If you want different behavior (like skip the cell and continue with the other cells), then you would handle teh PasteCelltext event. There you would check teh target cell and set e.cancel = true if it is readonly. private void gridControl1_PasteCellText(object sender, GridPasteCellTextEventArgs e) { if(e.Style.ReadOnly) e.Cancel = true; } If you need to paste style information (hence cannot turn off the styles flag as above), then you will have to handle ClipboardPaste and do all the work yourself.


AD Administrator Syncfusion Team December 16, 2004 08:24 AM UTC

Thanks Clay. It worked .

Loader.
Live Chat Icon For mobile
Up arrow icon