databind - XmlNodeList to DropDownList

  • Thread starter Thread starter Matthew.DelVecchio
  • Start date Start date
M

Matthew.DelVecchio

hello,

i am attempting to do some databinding of an XmlNodeList to a
DropDownList. id like to avoid looping thru my nodelist and hoped to do
a simple .DataSource/.DataBind technique.

for simplicity, lets say this is my xml:

<people>
<person name="Joe">[other child nodes w/ innertext]</person>
<person name="Bob">[other child nodes w/ innertext]</person>
<person name="Tim">[other child nodes w/ innertext]</person>
</people>

....and this is my code-behind:

'get person nodes
Dim personNodes As XmlNodeList = xml.SelectNodes("//person")

'bind to list
ddlYear.DataSource = personNodes
'ddlYear.DataTextField = ??
ddlYear.DataBind()


my desired result is a dropdownlist of items w/ text of:

Joe
Bob
Tim

....how does one do this?


thanks!
matt
 
Back
Top