This is a migrated thread and some comments may be shown as answers.

DropDownList nested hierarchy

2 Answers 154 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Morten
Top achievements
Rank 1
Morten asked on 29 Nov 2010, 01:48 PM
I have a xml file i need to databind to a DropDownList, the xml looks like this

<Category>
    <ID=1/>
    <Title=Main/>
    <ParrentID=0/>
</Category>
<Category>
    <ID=2/>
    <Title=Sub of Main/>
    <ParrentID=1/>
</Category>
<Category>
    <ID=3/>
    <Title=Level 3/>
    <ParrentID=2/>
</Category>
<Category>
    <ID=4/>
    <Title=Main 2/>
    <ParrentID=0/>
</Category>

is it possible to have the DropDownLost display it like this

Main 1
    Sub of Main
        Level 3
Main 2

2 Answers, 1 is accepted

Sort by
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 29 Nov 2010, 02:03 PM
Hello, 

As far as I'm aware, you cannot bind XML directly to a RadDropDownList. You would need to loop over your XML and create the RadListDataItems from it. Each RadListDataItem could then have some additional pre-text to indicate it's position. 

However, it looks like your scenario might call instead for a RadTreeView which can be bound to XML data and can include checkboxes for the nodes that you wish to select. 
Have a look at this documentation link regarding databinding to XML data fro the RadTreeView

If you need further help, please let me know. 
Thanks
Richard
0
Richard Slade
Top achievements
Rank 2
answered on 30 Nov 2010, 11:34 AM
Hello, 

How did you get on with this? If you need more help, just let me know. If this did help you, please mark as answer so others can find the solution too. 

All the best
Richard
Tags
DropDownList
Asked by
Morten
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Share this question
or