The .net framework provides the Dataset object which is designed to handle data abstractly independent of the data source. The DataSet can handle data from variety of sources like SQL,


In order access the DataSet class you must import the System.Data namespace into your page.
The DataSet has a ReadXML() method which is used to read data from an XML file.
XML File:
<ProductList>
<Products>
<ProductId>1</ProductId>
<ProductName>Rice</ProductName>
<Rate>27</Rate>
</Products>
<Products>
<ProductId>2</ProductId>
<ProductName>Wheat</ProductName>
<Rate>20</Rate>
</Products>
</ProductList>
DataSet DS = new DataSet();
DS.ReadXml(Server.MapPath("Products1.xml"));
DG1.DataSource = DS;
DG1.DataBind();
Thanks & Regards
Join the conversation! Your thoughts help the community grow.