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.

Clipborad copy/pase in GridControl

Thread ID:

Created:

Updated:

Platform:

Replies:

46405 Jul 12,2006 12:35 PM Jul 13,2006 10:34 AM Windows Forms 5
loading
Tags: GridControl
Ravichandran
Asked On July 12, 2006 12:35 PM

Hi, While pasting the clip board the values are also pasted in the first column for which I defined the celltype as "Static". But I dont want to paste the values in first column. Pls let me know how to do ASAP. Thanks Ravi

Administrator [Syncfusion]
Replied On July 12, 2006 06:56 PM

Hi Ravi, Please try setting the ReadOnly property for the static cells to true; this will avoid pasting of the values into static cells. Best regards, Madhan

Ravichandran
Replied On July 13, 2006 04:26 AM

Hi Madhan How to set that static cell to Readonly. BaseStylesMap["Row Header"].StyleInfo.CellType = "Static"; BaseStylesMap["Row Header"].StyleInfo.ReadOnly = true; Is this correct? Pls let me know Thanks Ravi >Hi Ravi, > >Please try setting the ReadOnly property for the static cells to true; this will avoid pasting of the values into static cells. > >Best regards, >Madhan >

Administrator [Syncfusion]
Replied On July 13, 2006 06:13 AM

Hi Ravi, By default you cant able to paste in the rowheaders. You can set ReadOnly to true for any specfic column through the code below, this.gridControl1.ColStyles[1].ReadOnly = true; If you have various cells in the grid declared as static, then you may query for the static cells in the QueryCellInfo event hander and set the ReadOnly property to true accordingly. if(e.Style.CellType == "Static") e.Style.ReadOnly = true; Let me know if you have any other questions. Thanks, Rajagopal

Ravichandran
Replied On July 13, 2006 07:03 AM

Hi Rajagopal, It didnt work..Pls find the code snippet below for event ClipboardPaste and also attached the screen shot pls let me know the solution protected void grid_ClipboardPaste(object sender, Syncfusion.Windows.Forms.Grid.GridCutPasteEventArgs e) { CommandStack.BeginTrans(@"Paste"); // Check to see if this is a paste of new securities if ( CurrentCell.ColIndex == (int)SecurityPricingDocument.SecurityPricingColumn.Identifier ) { DataObject data = Clipboard.GetDataObject() as DataObject; if ( data.GetDataPresent( DataFormats.Text ) ) { // Determine the number of rows to be pasted string s = data.GetData( DataFormats.Text ).ToString(); string[] rows = s.Split(new char[] { ''\n'' } ); int numRows = rows.GetLength(0); // Ignore blank line after the last line feed marker if (( numRows > 0) && (rows[(numRows - 1)].Length == 0)) numRows -= 1; // If we have valid row(s) to paste, check to see if we need to first create new empty rows int lastRowIndex = CurrentCell.RowIndex + numRows; if (lastRowIndex >= RowCount) Document.AddRows(numRows); // // For each pasted row, set the Extract checkbox int startRowIndex = CurrentCell.RowIndex; // for ( int rowIndex = startRowIndex; rowIndex < lastRowIndex; rowIndex++ ) // this[rowIndex, (int)SecurityPricingDocument.SecurityPricingColumn.].CellValue = true; } } OnModifiedChanged(new EventArgs()); CommandStack.CommitTrans(); } Thanks Ravi >Hi Ravi, > >By default you cant able to paste in the rowheaders. You can set ReadOnly to true for any specfic column through the code below, > >this.gridControl1.ColStyles[1].ReadOnly = true; > >If you have various cells in the grid declared as static, then you may query for the static cells in the QueryCellInfo event hander and set the ReadOnly property to true accordingly. > >if(e.Style.CellType == "Static") > e.Style.ReadOnly = true; > >Let me know if you have any other questions. >Thanks, >Rajagopal

image7.zip

Administrator [Syncfusion]
Replied On July 13, 2006 10:34 AM

Hi Ravi, When you are copying and pasting data from the clipboard, the default behavior is to copy and paste the style information with the text. In such case, the readonly cells will also get pasted. To avoid this you can turn off the default support for copying styles, through the below code. this.gridControl1.CutPaste.ClipboardFlags &= ~GridDragDropFlags.Styles; Also, please refer to forum thread below http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=22468 Let me know if this helps. Thanks, Rajagopal

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.

;