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.
Syncfusion Feedback

Cut/Copy/Paste on readonly cells

Thread ID:

Created:

Updated:

Platform:

Replies:

26020 Mar 11,2005 03:46 PM UTC Mar 11,2005 09:28 PM UTC Windows Forms 7
loading
Tags: GridControl
Faraz Haque
Asked On March 11, 2005 03:46 PM UTC

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

Administrator [Syncfusion]
Replied On 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.

Administrator [Syncfusion]
Replied On 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.

Administrator [Syncfusion]
Replied On 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;

Faraz Haque
Replied On 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; >

Administrator [Syncfusion]
Replied On 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

Faraz Haque
Replied On 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 >

Administrator [Syncfusion]
Replied On 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;
}
 

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

;