Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Help with XML parent child datagridviews

pcombs1pcombs1 Member Posts: 2
I have an XML file that has multiple levels in it. I have 2 datagridviews and want to display the child in the second one depending on which record is clicked on from the first.

Sub DefineColumns()
'colums defined here
End Sub

Sub BindingColumns()
mydataset.readxml(strFileName)
datagridview1.datasource = mydataset.defaultviewmanager
datagridview1.datamember = "Kit"

datagridview2.datasource = mydataset.defaultviewmanager
datagridview2.datamember = datagridview1.columns("Details").datapropertyname


snippet from XML file:




043
OS020
k3
N











044
Item
k5
N













I have tried different things and all i get in datagridview2 is all of the details of all of the kits. I only want the details from the selected kit. Any help is appreciated.

Thank You !


Comments

  • PsightoplazmPsightoplazm Member Posts: 332 ✭✭
    So... what is going on here is you are assigning the same XML dataset to the second datagrid. Just like your assignment to the first datagrid where you are telling it to list all of your "Kit" items, when you assign it to another datagrid and ask it to display "Details" items it just thinks you are telling it to display all of the detail items.

    I haven't worked with xml datasets much so I can't tell you a solid solution - but what you need to effectively do is extract the specified "Kit" item into it's own dataset and display the "Details" item of that secondary dataset in your secondary datagrid - rather than using the original, root dataset.

    You might be able to specify a specific root path, but I don't think that is going to help you in this case.
    ><//~Psightoplasm`~
  • pcombs1pcombs1 Member Posts: 2
    Thank you for replying. I understand what you are saying and I have tried several approaches. I have tried looking up on internet many different search criteria with not much luck. Any ideas to point me in the right direction is most appreciated.

    Thank you
Sign In or Register to comment.