yogiwales
Member
I got an xml file, how do I create a datagrid and add the data to it? Is it possible to update the data, and add to it aswell?
Imports System.Xml
Imports System.Data
Public Class WebForm1
Inherits System.Web.UI.Page
Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Put user code to initialize the page here
If Not Me.IsPostBack Then
Dim dataXML As New XmlDataDocument()
dataXML.DataSet.ReadXmlSchema(Server.MapPath("Catalog.xsd"))
dataXML.Load(Server.MapPath("catalog.xml"))
DataGrid1.DataSource = dataXML.DataSet.Tables(0)
DataGrid1.DataBind()
End If
End Sub