Hi,
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();
ds.ReadXml(Server.MapPath("Banks.xml"));
XmlDataDocument XMLDoc = new XmlDataDocument(ds);
//for populating the ddl_Banks
foreach (XmlNode XMLNodes in XMLDoc.SelectNodes("//bank[not(.=preceding::bank)]"))
{
ddl_Banks.Items.Add(
new ListItem(XMLNodes.ChildNodes[0].InnerText.ToString()));
}
}