DropDownList nested hierarchy

3 posts, 1 answers
  1. Morten
    Morten avatar
    2 posts
    Member since:
    Dec 2008

    Posted 29 Nov 2010 Link to this post

    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. Answer
    Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 29 Nov 2010 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 30 Nov 2010 Link to this post

    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
Back to Top