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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

copying GridStyleInfo

Thread ID:





24038 Jan 27,2005 10:53 AM UTC Jan 27,2005 11:21 AM UTC WinForms 1
Tags: GridControl
Andy Ullman
Asked On January 27, 2005 10:53 AM UTC

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 11:21 AM UTC

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);


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon