How to populate combobox with values from an xml file.
Using XmlDocument class you can loop thru the nodes of xml file and then just go on adding items to dropdownlist. Sample code:
XmlDocument doc = new XmlDocument();
doc.Load(Server.MapPath("regis.xml"));
XmlNodeList colorList = doc.SelectNodes("Information/Comments/Name");
foreach (XmlNode Name in colorList)
{
DropDownList1.Items.Add(Name.InnerText);
}
Ref : http://r4r.co.in/asp.net/01/tutorial/asp.net/How%20to%20populate%20combobox%20from%20xml%20file%20using%20c-Sharp%20in%20asp.net.shtml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With