Load XML to asp:DataGrid : XML DataGrid « XML « ASP.Net






Load XML to asp:DataGrid

<%@ Page language="VB" runat="server" %>
<%@ Import namespace="System.Data" %>
<%@ Import namespace="System.XML" %>

<script language="vb" runat="server">
  Sub Page_Load()
    Dim xmlFilename As String 
    xmlFilename= "artists.xml"
    Dim newDataSet As New DataSet
    newDataSet.ReadXML(xmlFilename)
    DataGrid1.DataSource = newDataSet
    DataGrid1.DataBind()
  End Sub
</script>

<html>
  <head>
    <title>Data Grid Control example</title>
  </head>
  <body>
    <asp:DataGrid id="DataGrid1" runat="server"  />
  </body>
</html>


<%--
<?xml version="1.0"?>
<artist>
  <item>
    <name>Vincent Van Gogh</name>
    <nationality>Dutch</nationality>
    <movement>Post Impressionism </movement>
    <birthdate>30th March 1853</birthdate>
  </item>
  <item>
    <name>Paul Klee </name>
    <nationality>Swiss </nationality>
    <movement>Abstract Expressionism </movement>
    <birthdate>18th December 1879</birthdate>
  </item>
  <item>
    <name>Max Ernst </name>
    <nationality>German </nationality>
    <movement>Surrealism </movement>
    <birthdate>2nd April 1891</birthdate>
  </item>
</artist>


--%>

           
       








Related examples in the same category

1.Bind XML file to DataSet and bind to asp datagrid
2.Read xml data and bind to datagrid in C#
3.DataSet read XML data and bind to asp datagrid
4.Bind data in XML to asp:DataGrid