View Single Post
Old November 23rd, 2007, 08:08 AM
Hughesie78 Hughesie78 is offline
Authorized User
Join Date: Nov 2007
Location: , , Ireland.
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Hughesie78
Default Sort XML in dropdownlist

I have a dropdown list on an aspx form which is being populated by distinct values on an XML file.
Now I need to sort the data in alpbabetical order. Any ideas?

Here is my code for populating the dropdown list:

   if (!Page.IsPostBack)
            // load the xml.
            DataSet ds = new DataSet();
            XmlDataDocument XMLDoc = new XmlDataDocument(ds);
            //for populating the ddl_Banks
            foreach (XmlNode XMLNodes in XMLDoc.SelectNodes("//bank[not(.=preceding::bank)]"))

                    new ListItem(XMLNodes.ChildNodes[0].InnerText.ToString()));

Thank You