Return List Value From Xml File.

Posted by Jayakumars under ASP.NET AJAX category on | Points: 40 | Views : 1078

I have post the Code for Xml For Read and assign List Collection.

refer this url :

public List<Contact> RetContact()
List<Contact> lst = new List<Contact>();
XmlDocument Doc=new XmlDocument ();
XmlNode root = Doc.SelectSingleNode("//contacts");
XmlNodeList XmlNdlist = root.SelectNodes("contact");

foreach (XmlNode n in XmlNdlist)
Contact c = new Contact();
c.Guid = n.SelectSingleNode("Guid").InnerText;
c.Name = n.SelectSingleNode("name").InnerText;
c.Email = n.SelectSingleNode("email").InnerText;
return lst;

protected void Bt_Submit_Click(object sender, EventArgs e)

List<Contact> lstContlist = new List<Contact>();
lstContlist = RetContact();

Comments or Responses

Login to post response