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.

GridControl Cut and Insert

Thread ID:

Created:

Updated:

Platform:

Replies:

29602 May 30,2005 09:05 AM Jun 1,2005 05:19 AM Windows Forms 5
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On May 30, 2005 09:05 AM

Hi, How can we cut and insert the row or rows in the Gridcontrol.(Behavior same like excel) If there is any sample application pls share regards Pratiksha

Administrator [Syncfusion]
Replied On May 30, 2005 10:29 AM

By default, you can mouse down and select a range of cells. Once the cells are selected, you can press ctl+C to copy them, and ctl+X to cut them. You can then paste them into Excel or any other application that accepts a text from the clipboard.

Administrator [Syncfusion]
Replied On May 30, 2005 10:46 PM

Can you pls tell how can we do that programatically. on the context menu option cut i was them to cut (just like excel) and when insert context menu is clicked i want selected cut rows to remove from the original position and inserted at the new positions >By default, you can mouse down and select a range of cells. Once the cells are selected, you can press ctl+C to copy them, and ctl+X to cut them. You can then paste them into Excel or any other application that accepts a text from the clipboard. > >

Administrator [Syncfusion]
Replied On May 31, 2005 04:22 AM

You can call these methods in a GridControl. gridControl1.CutPaste.Copy gridControl1.CutPaste.Paste gridControl1.CutPaste.Cut In a GridDataBoundGrid, the CutPaste object is a member of the gridDataBoundGrid1.Model.

Administrator [Syncfusion]
Replied On June 1, 2005 12:02 AM

Can you pls suggest method for adding the rows and deleting the rows in the Gridcontrol... so that the copied contents can be pasted in the newly inserted rows >You can call these methods in a GridControl. > >gridControl1.CutPaste.Copy >gridControl1.CutPaste.Paste >gridControl1.CutPaste.Cut > >In a GridDataBoundGrid, the CutPaste object is a member of the gridDataBoundGrid1.Model.

Administrator [Syncfusion]
Replied On June 1, 2005 05:19 AM

To insert rows and/cols, you will need to call grid.Rows.InsertRange and grid.Cols.InsertRange. To decide how many rows/columns you need to insert, you will have to get the data from the Clipboard and see how big the paste is. Here is a code snippet.
DataObject data = (DataObject) Clipboard.GetDataObject();

if(data.GetDataPresent(DataFormats.Text))

{

	string s = (string)data.GetData(DataFormats.Text);

	string[] rows = s.Split(new char[]{''\n''});

	int numRows = rows.GetLength(0);

	if(numRows > 0 && rows[numRows - 1].Length == 0)

		numRows--; //remove extra empty row if present

		int numCols = 0;

	if(numRows > 0)

	{

		string[] cols = rows[0].Split(new char[]{''\t''});

		numCols = cols.GetLength(0);

	}

	Console.WriteLine("{0} rows by {1} cols", numRows, numCols);

}

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.

;