binding XmlDataSource to CheckBoxList

Posted on 2013-06-03
Last Modified: 2013-06-20
Please see attached Image (lessonPage)

I want to have these checkboxes on the page, but powered from an xml file

Now look at the image (Code) and you will see what I have so far (which doesn't work)

to get a working example, i just want to show all the CATEGORIES items as checkboxes

here is the XML
        <Item SearchText="Creation">Creation</Item>
        <Item SearchText="The Flood">TheFlood</Item>
        <Item SearchText="Gods Chosen People">GodsChosenPeople</Item>
        <Item SearchText="Commandments">Commandments</Item>
        <Item SearchText="The Judges">TheJudges</Item>
        <Item SearchText="The Kings">TheKings</Item>
        <Item SearchText="The Prophets">TheProphets</Item>
        <Item SearchText="Jesus' Birth Christmas">JesusBirthChristmas</Item>
        <Item SearchText="Jesus' Death Easter">JesusDeathEaster</Item>
        <Item SearchText="Parables">TheParables</Item>
        <Item SearchText="Miracles">TheMiracles</Item>
        <Item SearchText="Disciples/Apostles">TheDisciples/Apostles</Item>
        <Item SearchText="People Jesus Met">PeopleJesusMet</Item>
        <Item SearchText="The Early Church">TheEarlyChurch</Item>

Open in new window

and here is what i've used for the ascx control

<asp:XmlDataSource  ID="XmlDataSource1" 

Open in new window

however it doesn't work and i've no idea why
Question by:websss
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 35

Accepted Solution

Robert Schutt earned 500 total points
ID: 39217410
Seems you're only missing the last level in the XPath property of your XmlDataSource; add /Item:
<asp:XmlDataSource  ID="XmlDataSource1" 

Open in new window

LVL 35

Expert Comment

by:Robert Schutt
ID: 39217439
By the way, the text that you have inside the Item nodes (without the spaces) might be what you want to use for the DataValueField property of your CheckBoxList. If that's the case then I think (haven't used it an awful lot myself yet) that you need an xsl transformation. Should be a relatively simple one in this case, but still it could be easier to make sure anything you want to use is contained in attributes, for example:
<Item SearchText="The Flood" ID="TheFlood" />

Open in new window

Then you could use:

Open in new window

Then again, if you don't need that part specifically, you can forget about this part ;-)

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Create a Dropdown list with sub group 10 43
What!!!??? 5 60
What is GIS method of Geometry data type? 6 33
ASP.NET VB code for check and insert in a table 4 45
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question