Hi Chriz,
Refer below code.
HTML
<asp:GridView runat="server" ID="GridView1" AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField="Id" HeaderText="Id" />
<asp:BoundField DataField="Name" HeaderText="Name" />
<asp:BoundField DataField="Country" HeaderText="Country" />
</Columns>
</asp:GridView>
Namespaces
C#
using System.Data;
using System.Xml;
VB.Net
Imports System.Data
Imports System.Xml
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
DataSet ds_response = new DataSet();
string xml = System.IO.File.ReadAllText(Server.MapPath("~/XML.txt"));
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xml);
XmlReader xmlReader = new XmlNodeReader(xmlDoc);
ds_response.ReadXml(xmlReader);
GridView1.DataSource = ds_response.Tables["Employee"];
GridView1.DataBind();
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim ds_response As DataSet = New DataSet()
Dim xml As String = System.IO.File.ReadAllText(Server.MapPath("~/XML.txt"))
Dim xmlDoc As XmlDocument = New XmlDocument()
xmlDoc.LoadXml(xml)
Dim xmlReader As XmlReader = New XmlNodeReader(xmlDoc)
ds_response.ReadXml(xmlReader)
GridView1.DataSource = ds_response.Tables("Employee")
GridView1.DataBind()
End Sub
Screenshot