This is a discussion on How to bind the xml data directly in to datgrid with out using dataset? within the ASP and ASP.NET Programming forums, part of the Web Development category; How to bind the xml data directly in to datgrid with out using dataset?...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| Code: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
Dim oXML As New XmlDataDocument
oXML.Load(Server.MapPath("Client.xml"))
DataGrid1.DataSource = oXML.SelectNodes("Client/Personal")
DataGrid1.DataBind()
End If
End Sub
<?xml version="1.0" encoding="utf-8" ?>
<Client>
<Personal>
<ClientID>1</ClientID>
<ClientName>Sample</ClientName>
</Personal>
<Personal>
<ClientID>2</ClientID>
<ClientName>Test</ClientName>
</Personal>
<Personal>
<ClientID>3</ClientID>
<ClientName>Example</ClientName>
</Personal>
<Personal>
<ClientID>4</ClientID>
<ClientName>Model</ClientName>
</Personal>
</Client> --R.Gopi |
| |||
| aspx page <asp:datagrid id="DataGrid1" runat="server" BorderColor="black" HeaderStyle-BackColor="#aaaadd" HeaderStyle-CssClass="tableHeader" ItemStyle-CssClass="tableItem" AllowPaging="False" width="700px" AutoGenerateColumns=False> <Columns> <asp:TemplateColumn headertext="Product ID" > <ItemTemplate > <asp:TextBox style= "width:100px;" id="ProductID" runat= "server" Text='<%# CType(Container.DataItem,System.XML.XMLNode)("Prod uctID").InnerText%>' > </asp:TextBox> </ItemTemplate> </asp:TemplateColumn> </asp:datagrid> Code Behind Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Not IsPostBack Then Dim oXML As New XmlDataDocument oXML.Load(Server.MapPath("product.xml")) DataGrid1.DataSource = oXML.SelectNodes("Product") DataGrid1.DataBind() End If End Sub |
![]() |
| Thread Tools | |
| Display Modes | |
| |
LinkBacks (?)
LinkBack to this Thread: http://www.discussweb.com/asp-asp-net-programming/2265-how-bind-xml-data-directly-datgrid-out-using-dataset.html | |||
| Posted By | For | Type | Date |
| Digg / Technology / Upcoming | This thread | Refback | 07-20-2007 04:59 AM |
| Digg / Technology / Upcoming | This thread | Refback | 07-20-2007 02:03 AM |
| Digg / News / Upcoming | This thread | Refback | 07-20-2007 02:02 AM |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| What is the difference between "using System.Data;" and directly adding the refer | KiruthikaSambandam | ASP and ASP.NET Programming | 1 | 11-15-2007 01:33 AM |
| Can anybody explain about the differences between dataset.clone and dataset.copy? | kingmaker | C# Programming | 2 | 08-28-2007 12:22 AM |
| What is the difference between "using System.Data;" and directly adding the reference | H2o | ASP and ASP.NET Programming | 1 | 07-24-2007 03:33 AM |
| How to bind data in repeater when i use two repeater's in nested format? | kingmaker | ASP and ASP.NET Programming | 1 | 07-20-2007 03:28 AM |
| I have a repeater in which I want to bind multiple images, if I... | kingmaker | ASP and ASP.NET Programming | 0 | 07-16-2007 11:22 PM |