Hi,
There are 3 tables in the DB: AàBàC
(A is the father, B is the son, C is the grandson).
I have 2 grids: grdA and grdC.
grdA has 2 Bands: band0 displays the data of tableA, band1 displays the data of table B.
grdC displays the data if table C.
I want that when I select a row in grdA-band1, the data in grdC will be updated accordingly.
Problem is that the data in grdC is updated according to the selected row in grdA-band0.
The grids are bounded to the tables in that way:
bsA – hold the data of table A.
grdA.DataSource = bsA;
bsB.DataSource = bsA;
bsB.DataMember = "B";
bsC.DataSource = bsB;
bsC.DataMember = "C";
grdC.DataSource = bsC;
Thanks ahead,
Yael
Hi Yael,
Changing the active row in the root band of grid A will automatically activate the first child row under that row. So that sounds correct.
Are you saying that activating a different child row in grid A has no effect on grid C? If that's the case, it may have to do with the BindingContext or the BindingManagers being different. Are grid A and grid C inside the same container? If not, you need to make sure they both have the same BindingContext. Try setting the BindingContext on both grid to the BindingContext of the form.
Hi Mike,
If I understand you right, this is what I did:
The relationship between B and C is bsC. I wrote:
Problem is that the data in grdC is updated according to the selected row in grdA-band0, but I want that it will be updated according to the selected row in grdA-band1.
Is it possible?
Thanks,Yael
Table C in your example here has no relation to table A.
I'm assuming you are using a DataSet here and you have tables A, B, and C in the same DataSet with relationships defined between tables A and B, and also between tables B and C.
What you need to do here is bind the second grid (grdC) to the Relationship (not the table) in your DataTable between tables B and C.