databind - XmlNodeList to DropDownList

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
 

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

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top