Set allowNew and allowDelete of two datagrids in a master-detail relationship

Set allowNew and allowDelete of two datagrids in a master-detail relationship

Post by Gary20 » Fri, 11 Aug 2006 16:56:09


Hello All,

I bind two datagrids in a master-detail relationship successfully.

What I want is to set allowNew and allowDelete disabled in both datagrid
using dataview.
The code like this:

Dim masterGrid As DataGrid
Dim detailGrid As DataGrid

Dim detailView As DataView
Dim masterView As DataView

masterView =
CType((CType(Me.BindingContext(detailGrid.DataSource,
detailGrid.DataMember), CurrencyManager).List), DataView)
With masterView
.AllowNew = False
.AllowDelete = False
.AllowEdit = False
End With

detailView =
CType((CType(Me.BindingContext(masterGrid.DataSource,
masterGrid.DataMember), CurrencyManager).List), DataView)
With detailView
.AllowNew = False
.AllowDelete = False
.AllowEdit = False
End With

I used the same method for the master and detail grid, but it works only
on master datagrid, not on detail grid.

If I set the datamember of the detail grid to the detail table not the
master-detail relationship,
then the detail grid works correctly, but not what I want. Set the
dataview works only on single grid not two related datagrids.

So, I think may be either the relationship or dataview I'm using is
wrong. Does anybody know?

Thanks in advance.

Regards,

Gary.
 
 
 

Set allowNew and allowDelete of two datagrids in a master-detail relationship

Post by Gary20 » Fri, 11 Aug 2006 21:06:41

Nobody knows? :(
Just want to display the master-detail data. So bad. Actually it is a
Parent-Child-GrandChild relation. Or any other ideas?

Many Thanks.
Gary