Click here to Skip to main content
15,888,968 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I want to retrieve the Datas from XML and display it in gridview, what is the solution for this.From this XML file.
XML
<?xml version="1.0" encoding="utf-8"?>
<EmpolyeeDetails>
  <Employee EmpId="001">
    <Name>Admin</Name>
    <Designation>SalesMan</Designation>
    <Phone>343434</Phone>
    <Address>xxxxxxx</Address>
    <Password>temp@123</Password>
  </Employee>
  <Employee EmpId="002">
    <Name>Kamal</Name>
    <Designation>6546565</Designation>
    <Phone>SalesMan</Phone>
    <Address>testing</Address>
    <Password>temp@123</Password>
  </Employee>
</EmpolyeeDetails>
Posted
Updated 23-Dec-11 0:39am
v2

This very same question was asked yesterday :
retrieving datas from xml[^]

Cheers
 
Share this answer
 
you can use XmlDataSource Class[^] which is used to represents an XML data source to data-bound controls.The XmlDataSource control is typically used to display hierarchical XML data in read-only scenarios.
Have a look there[^] for learn binding solution of Controls to XML Data.
 
Share this answer
 
VB
Dim Ds As DataSet = New DataSet
       Dim tb As DataTable = New DataTable
       Ds.ReadXml(Server.MapPath("~/filename.xml"))
       tb = Ds.Tables("Tablename")
       If Not Page.IsPostBack Then
           GridView1.DataSource = Ds
           GridView1.DataBind()
        End If
 
Share this answer
 
Comments
RaviRanjanKr 24-Dec-11 3:57am    
After using pre tag make sure to uncheck "Treat my content as plain text, not as HTML"

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900