BeanSoftware Logo
 

 
ASP.NET Database Search Control
 
 

 
 Home
    Shop
    Advertise
    Write For Us
    Affiliate
    Newsletter
    Contact

How To Read Data From XML To DataSet And Show In GridView?

Let say you have an XML file and you need to show its content on web form inside GridView control. You can do it with code like this:

[ C# ]

DataSet dsContacts = new DataSet();
dsContacts.ReadXml(Server.MapPath("Contacts.xml"));
GridView1.DataSource = dsContacts;
GridView1.DataBind();

[ VB.NET ]

Dim dsContacts As DataSet = New DataSet()
dsContacts.ReadXml(Server.MapPath("Contacts.xml"))
GridView1.DataSource = dsContacts
GridView1.DataBind()



Related articles:

1. DataSet and DataAdapter in ASP.NET 2.0 - Part 2 of 2

FAQ toolbar: Submit FAQ  |  Tell A Friend  |  Add to favorites  |  Feedback



Copyright © 2002-2008 Bean Software. All rights reserved.