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/Copy/Paste on readonly cells

How can I enable gridwide cut/copy/paste on readonly/static cells. It seems to me that clipboard functions are not provided by default on datagrid or datagrouping grid. I am required to add clipboard functions to all my grids, and i was hoping for a design time property. Table/Column/Row copy functionality would be helpful too

7 Replies

AD Administrator Syncfusion Team March 11, 2005 05:44 PM UTC

For a GridControl, by default, the grid supports copy/paste of both Text and Styles. When styles are being copied/pasted from a GridControl to a GridControl, then it will paste and cut static/readonly cells. If you turn off the style copy/paste support and only use the text suppoer, then you cannot paste over or cut readonly cells, but you can cut/paste static cells. For a GridDataBoundGrid, by default, the grid only supports copy/pasting Text. This means that ReadOnly settings are respected(and this seems to be the use case our user''s requested most as in out 1.0 release, you could paste over readonly cells, and this caused problems.) So, in a GridDataBoundGrid, if you need to cut/paste cells ReadOnly cells, the simplest thing would be to make them Static cells. In a GridGroupingControl, if you set this.groupingGrid1.TableOptions.AllowSelection = GridSelectionFlags.Any; you will get more or less the same behavior as a GridDataBoudGrid as long as you restrict your selections to actual records. But copying groups and nested tables is not currently supported.


AD Administrator Syncfusion Team March 11, 2005 08:08 PM UTC

Ok, this is my situation. I added a groupinggrid to a form. Now, to make it readonly, I added the AnyRecordCell.CellType = "Static". The problem is that this doesnt even let me "Copy". I understand, cut and paste should not be allowed at this point, but why is copy supressed as copy is a "readonly" request. thanks -Faraz >For a GridControl, by default, the grid supports copy/paste of both Text and Styles. When styles are being copied/pasted from a GridControl to a GridControl, then it will paste and cut static/readonly cells. If you turn off the style copy/paste support and only use the text suppoer, then you cannot paste over or cut readonly cells, but you can cut/paste static cells. > >For a GridDataBoundGrid, by default, the grid only supports copy/pasting Text. This means that ReadOnly settings are respected(and this seems to be the use case our user''s requested most as in out 1.0 release, you could paste over readonly cells, and this caused problems.) So, in a GridDataBoundGrid, if you need to cut/paste cells ReadOnly cells, the simplest thing would be to make them Static cells. > >In a GridGroupingControl, if you set > >this.groupingGrid1.TableOptions.AllowSelection = GridSelectionFlags.Any; > >you will get more or less the same behavior as a GridDataBoudGrid as long as you restrict your selections to actual records. But copying groups and nested tables is not currently supported.


AD Administrator Syncfusion Team March 11, 2005 08:31 PM UTC

Did you set TableOptions.AllowSelections = Any as mentioned above? Using 3.0.1.0, I am able to copy when I set a DataSource and use these property settings: this.gridGroupingControl1.DataSource = dt; this.gridGroupingControl1.TableDescriptor.Appearance.AnyRecordFieldCell.CellType = "Static"; this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.Any;


FH Faraz Haque March 11, 2005 08:44 PM UTC

hmm..I just tried it and it Ctrl C doesnt seem to do anything. Do I need to write custom code to do the "copy"? i was hoping I get a control C option >Did you set TableOptions.AllowSelections = Any as mentioned above? > >Using 3.0.1.0, I am able to copy when I set a DataSource and use these property settings: > >this.gridGroupingControl1.DataSource = dt; >this.gridGroupingControl1.TableDescriptor.Appearance.AnyRecordFieldCell.CellType = "Static"; >this.gridGroupingControl1.TableOptions.AllowSelection = GridSelectionFlags.Any; >


AD Administrator Syncfusion Team March 11, 2005 08:56 PM UTC

You have to drag and select some cells but that is all. Here is a sample that works for me. http://www.syncfusion.com/Support/user/uploads/GGC_ReadOnlyCopy_f16736c9.zip


FH Faraz Haque March 11, 2005 09:09 PM UTC

Ah ok. So, we can select and copy multiple cells. But how do we select one? I tried clicking on one cell and hitting ctrl c (in ur example). Nothing in clipboard. >You have to drag and select some cells but that is all. Here is a sample that works for me. > >http://www.syncfusion.com/Support/user/uploads/GGC_ReadOnlyCopy_f16736c9.zip >


AD Administrator Syncfusion Team March 11, 2005 09:28 PM UTC

To copy a single static cell, you will have to handle the canCopy event and allow this case.
private void TableModel_ClipboardCanCopy(object sender, GridCutPasteEventArgs e)
{
	e.IgnoreCurrentCell = false;
	e.Result = true;
	e.Handled = true;
}

            

Loader.
Live Chat Icon For mobile
Up arrow icon