Geeks With Blogs
AzamSharp Some day I will know everything. I hope that day never comes.
You can easily populate a DropDownList with the data from the xml file. Check out the code below:

XML File

 


	
    hank 
    
    
    corry
    
    
    david
     
    
    james
    
 

C# CODE

 
XmlDocument doc = new XmlDocument();
				doc.Load(Server.MapPath("Menu.xml"));
				XmlNodeList nodeList = doc.SelectNodes("names/name");

				foreach(XmlNode node in nodeList)
					DropDownList1.Items.Add(new ListItem(node.SelectSingleNode("client").InnerText));
			
Posted on Thursday, August 18, 2005 1:31 PM | Back to top


Comments on this post: Populating DropDownList using Xml File

# re: Populating DropDownList using Xml File
Requesting Gravatar...
really helpful. my query is answered

thanks
Vikas
Left by Vikas K on Feb 04, 2007 5:25 AM

# re: Populating DropDownList using Xml File
Requesting Gravatar...
Thank you very much! Very simple and right to the point.
Left by Jack on Apr 21, 2007 3:07 AM

Your comment:
 (will show your gravatar)


Copyright © Mohammad Azam | Powered by: GeeksWithBlogs.net