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.

copying GridStyleInfo

Thread ID:

Created:

Updated:

Platform:

Replies:

24038 Jan 27,2005 05:53 AM Jan 27,2005 06:21 AM Windows Forms 1
loading
Tags: GridControl
Andy Ullman
Asked On January 27, 2005 05:53 AM

Hi, I have several small GridControls with just a few rows each. They contain lots of formatting, comboboxes, checkboxes etc. At runtime, I need to create a large GridControl using the small ones as a source i.e. by repeatedly copying the cells from the small grids to the large. The large grid may end up with thousands of rows. I tried using GridStyleInfo.CopyFrom(), but it was slow, and didn''t seem to handle some of the cells (checkboxes, combos''s etc.) properly. I also tried instantiating new GridStyleInfo''s using the source GridStyleInfo as an argument to the constructor. That was much faster, but I must be doing something wrong, because the new cells seem "connected" to the old (ie if I enter a value in the cell, it affects the cell I used as a source). Do you think this is the best approach to the problem - if so, what am I doing wrong? Thanks, Andy

Administrator [Syncfusion]
Replied On January 27, 2005 06:21 AM

You might try using these two methods to copy data from one grid and then move it into another. this.gridControl1.DataExchange.CopyCellsToDataObject this.gridControl1.DataExchange.PasteCellsFromDataObject Here is a little snippet that moves 1 grid to another. You would have to set the paste row/col to move to the proper location.
private void button1_Click(object sender, System.EventArgs e)
{
	GridData data = new GridData();
	int rowCount, colCount;
	GridRangeInfo range = GridRangeInfo.Table();
	range = range.ExpandRange(1, 1, this.gridControl1.RowCount, this.gridControl1.ColCount);
	this.gridControl1.DataExchange.CopyCellsToDataObject(out data, range, false, GridDragDropFlags.Styles, out rowCount, out colCount);
	this.gridControl2.DataExchange.PasteCellsFromDataObject(data, GridRangeInfo.Cell(1,1), true, GridDragDropFlags.Styles);
}

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.

;