Sorting XML data in a dropdown list on asp.net
Hi there
I have a drop down list reading from an XML Doc into a dataset and an XMLDataDOc, it is pulling in a list of unqique values from the XML doc and loading them to a drop down list, my prolem is that they are not sorted. I want to sort them alplabetically but im not sure who to do this, I read a suggestion yesterday to use an XSL file, but I am not sure how to incorporate this into my code below, any suggestions..
if (!Page.IsPostBack)
// load t
{
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("Banks.xml"));
XmlDataDocument XMLDoc = new XmlDataDocument(ds);
foreach (XmlNode XMLNodes in XMLDoc.SelectNodes("//bank[not(.=preceding::bank)]"))
{
ddl_Banks.Items.Add(new ListItem(XMLNodes.ChildNodes[0].InnerText.ToString()));
}
}
__________________
Thank You
|