Bind XML file to DataSet and bind to asp datagrid : XML DataGrid « XML « ASP.Net

ASP.Net
1. ADO.net Database
2. Asp Control
3. Collections
4. Components
5. Data Binding
6. Development
7. HTML Control
8. Mobile Control
9. Page
10. Request
11. Response
12. Server
13. Session Cookie
14. User Control and Master Page
15. Validation by Control
16. Validation by Function
17. XML
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
ASP.Net » XML » XML DataGrid 
Bind XML file to DataSet and bind to asp datagrid

<%@ Import namespace="System.Data" %>

<html>
  <head>
    <title>Read XML file</title>
  </head>
  <body>
    <H2>Read XML file</H2>
      <asp:Label id="lblXMLFileName" runat="server" /><BR/><BR/>
      <asp:DataGrid id="dgServers" runat="server" />
  </body>
</html>

<script language="VB" runat="server">
Sub Page_Load(Source As Object, E As EventArgs)
  Dim strXMLFile As String = MapPath("Multiple_levels.XML")
  lblXMLFileName.Text = strXMLFile

  Dim objDataSet As New DataSet()
  objDataSet.ReadXml(strXMLFile)

  dgServers.DataSource = objDataSet.Tables(0).DefaultView
  dgServers.DataBind()
End Sub
</script>

<%--
<?xml version="1.0" standalone="yes"?>
<CarList>
  <Car>
    <ModelName>A</ModelName>
    <Doors>2</Doors>
    <ColorList>
      <Color>Color 2</Color>
      <Color>Color 3</Color>
      <Color>Color 4</Color>
    </ColorList>
  </Car>
  <Car>
    <ModelName>Model 2</ModelName>
    <Doors>3</Doors>
    <ColorList>
      <Color>Red</Color>
      <Color>Yellow</Color>
      <Color>Blue</Color>
    </ColorList>
  </Car>
</CarList>
--%>
           
       
Related examples in the same category
1. Read xml data and bind to datagrid in C#
2. DataSet read XML data and bind to asp datagrid
3. Bind data in XML to asp:DataGrid
4. Load XML to asp:DataGrid
w___ww.___ja_v___a___2s___.com_ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.