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 grid records

Thread ID:

Created:

Updated:

Platform:

Replies:

56330 Feb 13,2007 01:38 PM Feb 14,2007 12:03 PM Windows Forms 3
loading
Tags: GridControl
dinesh upreti
Asked On February 13, 2007 01:38 PM

Hi,
I am using gridgrouping control.
I am trying to simulate copy functionality in the grid, but not exactly a copy paste. I am using custom entities to bind the solution. The catch here is that the custom entity is having another entity as a property, so the entity is not pretty flat. Now when I say copy, I want that certain values should be excluded in the copied data.

product entity

public class product
{
private int id;
public int Id
{
get { return id; }
set { id = value; }
}
private string type;
public string Type
{
get { return type; }
set { type = value; }
}
Dictionary _productFeatures;
public Dictionary ProductFeatures
{
get { return _productFeatures; }
set { _productFeatures = value; }
}
}

feature entity

public class feature
{
private int featureId;
public int FeatureId
{
get { return featureId; }
set { featureId = value; }
}
private int featureDescription;
public int FeatureDescription
{
get { return featureDescription; }
set { featureDescription = value; }
}
}

In the example above, product is having a collection of ProductFeatures and I am binding a collection of product entities to grid.
Now when I select a product on grid and click on a button which invokes copy, I want a new record to be inserted into the grid except the product id(which I am getting from Data base).

The follwing code works fine if I have to just copy the product, had it been a flat entity

newID = GetNewIDFromDB()
this.dgRangePlanGrid.Table.AddNewRecord.SetCurrent();
this.dgRangePlanGrid.Table.AddNewRecord.BeginEdit();
this.dgRangePlanGrid.Table.CurrentRecord.SetValue("id", newID);
this.dgRangePlanGrid.Table.AddNewRecord.EndEdit();

what do I do when product is having a collection inside?

Administrator [Syncfusion]
Replied On February 13, 2007 03:04 PM

Hi Dinesh,

This can be achieved by using the TableModel.ClipboardCopy add the information you want to the clipboard and then handle TableModel.ClipboardPaste and retrieve your clibboard object and use it. Here is a forum thread discuss with the simillar issue.

http://www.syncfusion.com/support/forums/message.aspx?&MessageID=10877

Best regards,
Haneef

dinesh upreti
Replied On February 14, 2007 06:04 AM

hi,

Let me make my problem more clear. The copy functionality I am looking for is not the copy pase in classical sense. I select a row, click on a button "Copy", and the selected row gets added in the grid, without the user invoking any paste. The copied data doesnot goes into the clipboard as i am not doing any ctrl+c.

Another quey is that after the data has been bound to a grid, if there are any changes in the underlying data source by some other process, how to get those changes reflected in the Grid?

Thanks

Administrator [Syncfusion]
Replied On February 14, 2007 12:03 PM

hi,

Let me make my problem more clear. The copy functionality I am looking for is not the copy pase in classical sense. I select a row, click on a button "Copy", and the selected row gets added in the grid, without the user invoking any paste. The copied data doesnot goes into the clipboard as i am not doing any ctrl+c.

Another quey is that after the data has been bound to a grid, if there are any changes in the underlying data source by some other process, how to get those changes reflected in the Grid?

Thanks

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.

;