views:

251

answers:

2

I am binding a Treeview to an XMLDataSource, The databindings are being generated automaticaly, The XML looks like this:-

<Passengers>
  <Passenger>
    <PassengerName>Name1</PassengerName>
  </Passenger>
  <Passenger>
    <PassengerName>Name2</PassengerName>
  </Passenger>
  <Passenger>
    <PassengerName>Name3</PassengerName>
  </Passenger>
</Passengers>

The Treeview displays the XML correctly but when i click on a node and the SelectedNodeChanged event fires the SelectedNode.DataPath is always the path to the first passenger in the list no matter which passenger node i click on.

Does anyone know how to get the datapath of the actual node i click on ?

A: 

from here i think it can't distinguish the passenger nodes. they kinda lack some kind of id. checking out help on treeview databinding at the moment i'll be back.

Well help says you can adjust how and what you bind from your xmldatasource to what node properties. might be that you miss the value and navigateurl properties in your binding.

Alexander Taran
A: 

Hey,

I beleive tree nodes use a value, which has to be supplied in order to navigate a value path trail. Only then can you navigate a trail. Also, not sure, but I thought the XmlDataSource liked using attributes instead of child elements, to describe and entities values, so that may be a problem too...

Brian