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
close icon

Passing value into a parent grid cell

Hello, I am having a problem of inconsistent update of a parent cell. The parent grid is a GDBD which has some cells of drop-down celltype. The drop down form contains a grouping grid with buttons OK and Cancel. When a use performs certain actions the grouping grid displays a total in a summary row. On button click the total should be displayed in a parent cell (which is int the gdbg). Sometimes, the value does not get into the parent grid. it always does it for the first time, but if a user opens the same DD and edit entered hours, the total (which is updated correctly) soed not get displayed in the parent grid - sometimes it is just the old value, but in some cases simply gets empty. I am using version 2.0.5.1 Could you please advise on how to resolve this issue. I attach a code snippet that handles OK button. Thanks. if( this.ddActivityForm.ShowDialog() == DialogResult.OK ) { this.Grid.BeginUpdate(); this.Grid.Model[rowIndex, colIndex].Text = this.ddActivityForm.TotalActivityHrs; this.Grid.EndUpdate(); this.Grid.Refresh(); }

3 Replies

AD Administrator Syncfusion Team August 4, 2005 04:44 PM UTC

Try adding these calls: this.Grid.CurrentCell.EndEdit(); this.Grid.Binder.EndEdit(); this.Grid.BeginUpdate(); this.Grid.Model[rowIndex, colIndex].Text = this.ddActivityForm.TotalActivityHrs; this.Grid.EndUpdate(); this.Grid.Refresh(); to see if this will resolve this problem. When the currentcell is editing, setting a value into the style does not necessarily affect the actively editing value. The idea is to make sure teh currentcell is not actively editing when you try to set its value.


IK Igor Kashtelyan August 4, 2005 04:59 PM UTC

Sorry, Clay, It is not working...Binder is not even a public property of a Grid in this case... What would be the right way to pass a value into a parent cell in general? May be I will be able to modify original code to update the parent cell?... Thanks. >Try adding these calls: > > >this.Grid.CurrentCell.EndEdit(); >this.Grid.Binder.EndEdit(); > > >this.Grid.BeginUpdate(); >this.Grid.Model[rowIndex, colIndex].Text = this.ddActivityForm.TotalActivityHrs; >this.Grid.EndUpdate(); >this.Grid.Refresh(); > >to see if this will resolve this problem. When the currentcell is editing, setting a value into the style does not necessarily affect the actively editing value. The idea is to make sure teh currentcell is not actively editing when you try to set its value.


AD Administrator Syncfusion Team August 4, 2005 05:33 PM UTC

>>Binder is not even a public property of a Grid in Is this Grid, the Grid property of the renderer class? If so, you can cast it to a GridDataBoundGrid provided the parent grid is a GridDataBoundGrid. Normally, in a derived renderer, you override OnSaveChanges, and there you set Grid.Model[RowIndex, ColIndex] to be the changed value. To make sure OnSaveChanges is called, make sure the CurrentCell.IsModified is set true when the value changes in your renderer. I think this is what the dropdownusercontrol sample we ship uses. Since this is a GridDataBoundGrid, you also have teh option of trying to set teh value directly into the DataSource if you know enough about it.

Loader.
Live Chat Icon For mobile
Up arrow icon