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.

updatable expanding grid

Thread ID:

Created:

Updated:

Platform:

Replies:

16891 Jul 27,2004 12:04 AM Jul 27,2004 01:39 PM Windows Forms 3
loading
Tags: GridControl
Herman Muys
Asked On July 27, 2004 12:04 AM

Hi all, I''m trying to implement a updatable expanding, hierarchic databound grid, based on the disconnected ado.net model. On the forum I found some examples(UpdatableExpandGrid_VB,...). They dynamically hook and unhook ListChanged event handler on expanding and collapsing a hierarchic databoun grid. If, in a master detail view , I change the Primary Key of a row of the parent table, the foreign key fields in the child table are updated by means of a cascading update rule IF that (parent)row is collapsed on editing. If I expand the parent row , as I said, the child rows shows correct. However, IF I try to change the primary key of that same parent record, while this row is expanded, a ListChangedType.ItemDeleted event is fired for each of the child rows. A trace message shows up: "Deactivate called while the current cell was in process of activating or deactivating a cell. Calling CurrentCell.Lock() will prevent this exception" any idea how to cach this behaviour? It is reproducable with the examples on the forum. I''m tryng to implement a disconnected datamodel: On Adding a record in the master detail grid, I give a temporay primary key to the new record. This temporay PK , is updated with the real PK on connecting with the database . Thanks Herman

Administrator [Syncfusion]
Replied On July 27, 2004 01:19 AM

So everything works OK if the parent row is not expanded, correct? In that case what I would try first is to handle CurrentCellValidating and CurrentCellMoved. In CurrentCellValidating, check if the the currentcell is the primary key on an expanded parent row. In that case set an editingPrimaryKeyOnExpandedRow flag to indicate you are editing a primary key in an expanded parent row. Then call grid.BeginUpdate and grid.Collapse to collapse the parent row. Then in CurrentCellMoved, if the editingPrimaryKeyOnExpandedRow is set, expand the row, call grid.EndUpdate and, possibly, grid.Refresh.

Herman Muys
Replied On July 27, 2004 12:43 PM

Hi, Yes eveythings works well if the parent row is not expanded. However, if I try to implement the proposed solution, i''m lost in a endless loop. (the validating event triggers a new validating event) private void OnCurrentCellValidating( object sender, System.ComponentModel.CancelEventArgs e) { GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell; this.gridDataBoundGrid1.BeginUpdate (); this.gridDataBoundGrid1.CollapseAtRowIndex( cc.RowIndex); } Any idea why the cascading updating rule causes a ListChangedType.ItemDeleted event when the parent row is expanded? Herman

Administrator [Syncfusion]
Replied On July 27, 2004 01:39 PM

>However, if I try to implement the proposed solution, i''m lost in a endless loop. (the validating event triggers a new validating event) > You can probably avoid this by setting a flag. private bool inValidation = false; private void OnCurrentCellValidating( object sender, CancelEventArgs e) { if(!inValidation) { inValidation = true; GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell; this.gridDataBoundGrid1.BeginUpdate (); this.gridDataBoundGrid1.CollapseAtRowIndex(cc.RowIndex); inValidation = false; } } >Any idea why the cascading updating rule causes a ListChangedType.ItemDeleted event when the parent row is expanded? I do not know what you mean by cascading updating rule, but if the edit forces a record to move from one child table to another, then if has to be deleted from one before it can be added to another. Each child table has its own DataView associated with it and its own CurrencyManager.

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.

;