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

Copying grid records

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?

3 Replies

AD Administrator Syncfusion Team February 13, 2007 08:04 PM UTC

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


DU dinesh upreti February 14, 2007 11:04 AM UTC

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


AD Administrator Syncfusion Team February 14, 2007 05:03 PM UTC

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

Loader.
Live Chat Icon For mobile
Up arrow icon