Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 119109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:36:03+00:00 2026-05-11T03:36:03+00:00

Greetings! I have some XML like this: <Root> <MainSection> <SomeNode>Some Node Value</SomeNode> <SomeOtherNode>Some Other

  • 0

Greetings!

I have some XML like this:

<Root>     <MainSection>         <SomeNode>Some Node Value</SomeNode>         <SomeOtherNode>Some Other Node Value</SomeOtherNode>         <Areas>             <Area someattribute='aaa' name='Alpha' value='0' />             <Area someattribute='bbb' name='Beta' value='1' />             <Area someattribute='ddd' name='Delta' value='2' />         </Areas>     </MainSection> </Root> 

I have a FormView on my web form in which many of the values are bound. I’d like to bind the Areas child nodes to a DropDownList like so:

<asp:FormView ID='MyFormView' runat='server' DataSourceID='MyXmlDataSource'>     <ItemTemplate>         <h1><%# XPath('SomeNode')%></h1>         <asp:Label ID='MyLabel' runat='server' AssociatedControlID='MyDdl' Text='<%# XPath('SomeOtherNode')%>' />         <asp:DropDownList ID='MyDdl' runat='server' DataSource='<%# XPathSelect('Areas/*') %>' DataTextField='name' DataValueField='value'></asp:DropDownList>     </ItemTemplate> </asp:FormView> <asp:XmlDataSource ID='MyXmlDataSource' runat='server' XPath='Root/MainSection' /> 

Unfortunately, instead of seeing the data that I’d expect in the dropdown list, I see 3 entries with ‘Area’ as the text and no values.

I know that my XML is ok because for testing purposes, I tried throwing a Repeater control on the page like so:

<asp:Repeater ID='MyRepeater' runat='server' DataSource='<%# XPathSelect('Areas/*') %>'>     <ItemTemplate>         <%# XPath('@name') %> - <%# XPath('@value') %><br />     </ItemTemplate> </asp:Repeater> 

And that worked fine.

Is there something that I’m doing wrong when binding to the dropdown list, perhaps with the DataTextField and DataValueField properties?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T03:36:04+00:00Added an answer on May 11, 2026 at 3:36 am

    XPathSelect doesn’t return a DataSource that can be directly bound like that. Just as you had the FormView bound and your bindings with in it used XPath(‘…’) not Bind(‘…’), you have the same issue with the DropDownList. Either build a standard DataSource with your attributes and bind the DDL to that, or roll your own HTML with a ListView that generates the select option tags or something like that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 82k
  • Answers 82k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The IIS admin tools will be available on the production… May 11, 2026 at 4:36 pm
  • Editorial Team
    Editorial Team added an answer http://www.teachitza.com/delphi/databasehowto.htm it is realy simple and easy task with 5-10… May 11, 2026 at 4:36 pm
  • Editorial Team
    Editorial Team added an answer First of all, you should also look into the Event-based… May 11, 2026 at 4:36 pm

Related Questions

Greetings! I have some XML like this: <Root> <AlphaSection> . . . </AlphaSection> <BetaSection>
Greetings! I'm looking for some advice regarding an approach to displaying data in a
Grettings! I have some XML that looks like this: <Root> <SectionA> <Item id=111> <Options>
If I have an XML document like this: <root> <elem name=Greeting> Hello </elem> <elem

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.