I have a Master-Details GDBG (using DataSet Relations). The details grid contains a combo box in the first column. I added a handler for the Enter event, as suggested previously in this forum, for the details grid (gridDataBoundGrid2) to fix a problem that caused new rows not to be added unless at least one row was already present:
private void gridDataBoundGrid2_Enter(object sender, System.EventArgs e)
{
if(this.gridDataBoundGrid2.Model.RowCount == 1)
{
this.gridDataBoundGrid2.Binder.AddNew();
this.gridDataBoundGrid2.CancelUpdate();
}
}
However, now I am observing a problem I don''t know how to resolve. If a row in the master grid is selected which has existing rows in the details grid, and rows are added to those details using the "new row" in the combo box, everything is fine. But if immediately afterwards, I then select a row in the master grid that has no rows in the details grid, and try to pull down the combo box in the details, I receive the message: "Index was outside the bounds of the array" as soon as I click the combo box down arrow button. Also, the debug TRACE lines show as:
catched at Syncfusion.Windows.Forms.Grid.GridDataBoundGrid.EndEdit() in :line 0
catched at Syncfusion.Windows.Forms.Grid.GridCurrentCell.Deactivate(Boolean discardChanges) in :line 0
Any help would be appreciated.
--Van Baker
AD
Administrator
Syncfusion Team
September 30, 2004 02:42 PM UTC
In the sample you referenced, I added a combobox to column 1 of the grid3, and could see the problem you described. Adding this code worked around it for me in that sample.
bool doOnce = true;
private void gridDataBoundGrid3_Enter(object sender, EventArgs e)
{
if(doOnce && this.gridDataBoundGrid3.Model.RowCount == 1)
{
doOnce = false;
this.gridDataBoundGrid3.Binder.AddNew();
}
}
VB
vbaker
September 30, 2004 06:06 PM UTC
Thanks. That helped a lot; however, I still get the error message the very first time I go through the scenario. After that, it seems to not occur anymore.
--Van Baker
AD
Administrator
Syncfusion Team
September 30, 2004 06:45 PM UTC
Try adding the
this.gridDataBoundGrid2.CancelUpdate();
line to the code to see if that avoids the error the first time.
CP
Christian Pogea
December 17, 2004 12:09 PM UTC
Can you provide me with a sample code with a master detail grid.
master has only text boxes and detail has only one combobox.
it is very frustating, ''cause i tell you this issue a couple of month ago. when is it fixed?
there are a lot of problems with master-details in griddataboundgrid.
>Try adding the
>
>this.gridDataBoundGrid2.CancelUpdate();
>
>line to the code to see if that avoids the error the first time.
AD
Administrator
Syncfusion Team
December 17, 2004 02:18 PM UTC
I am not sure what kind of sample you wanted. Did you submit a Direct Support incident on teh problem you are having?
If it is teh problem with the details table being empty initially, then I think that is fixed in our 3.0 code base. Here a sample that runs ok in 3.0 for me, but does not run in 2.1.0.9.
http://64.78.18.34/support/user/uploads/GDBG_MasterDetail120172004.zip
CP
Christian Pogea
December 17, 2004 02:53 PM UTC
does this mean i have to pay for the update, because you didn''t fix this bug in 2.1.0.9 ???
>I am not sure what kind of sample you wanted. Did you submit a Direct Support incident on teh problem you are having?
>
>If it is teh problem with the details table being empty initially, then I think that is fixed in our 3.0 code base. Here a sample that runs ok in 3.0 for me, but does not run in 2.1.0.9.
>
>http://64.78.18.34/support/user/uploads/GDBG_MasterDetail120172004.zip
AD
Administrator
Syncfusion Team
December 17, 2004 10:13 PM UTC
You can contact sales@syncfusion.com for your options.
CP
Christian Pogea
March 14, 2005 04:58 PM UTC
dear clay,
i upgraded to syncfusion 3.0.1.0 and there are still bugs in master detail tables. just use your sample to see the issues.
1. go to the "new line" use 5 as the new parentID, type "test5" as parentName. click on the combobox and chose "ChildName0"
2. go to the "new line" use 6 as the new
parentID, type "test6" as parentName. click on
the combobox and chose "ChildName1"
go back to our parentID 5 row. the combobox settings are gone. now go to our parentID 6 row and the combobox settings are gone, too.
is there a workaround available?
AD
Administrator
Syncfusion Team
March 14, 2005 06:51 PM UTC
Here is a sample that I think works in 3010 using teh steps you outlined. It turns off the UseListChangedEvent property and handles the grid1.Leave event to make sure the datatable has the changes applied at that point.
http://www.syncfusion.com/Support/user/uploads/GDBG_MasterDetail_bdc0369a.zip
CP
Christian Pogea
March 16, 2005 03:37 PM UTC
dear clay,
AcceptChanges() doesn''t solve the problem, ''cause i can''t save the changes to the database, later. i need a solution without acceptchanges.
AD
Administrator
Syncfusion Team
March 16, 2005 06:21 PM UTC
Try this.
private void gridDataBoundGrid1_Leave(object sender, EventArgs e)
{
if(this.gridDataBoundGrid1.Binder.IsEditing)
{
this.gridDataBoundGrid1.CurrentCell.EndEdit();
this.gridDataBoundGrid1.Binder.EndEdit();
CurrencyManager cm = this.gridDataBoundGrid1.BindingContext[this.gridDataBoundGrid1.DataSource, this.gridDataBoundGrid1.DataMember] as CurrencyManager;
cm.Refresh();
}
}