Set allowNew and allowDelete of two datagrids in a master-detailrelationship

G

Gary200

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.
 
G

Gary200

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top