.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Melody Anderson
Eminent IT

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

xml in C#

Posted By: vikas     Posted Date: January 03, 2010    Points:2   Category :ASP.Net
i hav a xml file in asp.net with c# application.it contain data
<Inbox id="1" assigned_user_id="" bcc_address="" bcc_address_names="" cc_address="" cc_address_names="" to_address="" />
i want to select data from xml file where id=1;
then outcome output bind with Detalview..

Author: Lalij Mer             
Posted Date: January 05, 2010     Points: 5   

Show this example you may get idea.

do first create a new XML-File and populate it with some data,show here example:

<?xml version="1.0" encoding="utf-8" ?>

bind xml file to gridview

Drag a GridView control on your web form. Next you need some code to bind the data from the XML-file to your GridView.

Imports System.Data
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim oDs As New DataSet
oDs.ReadXml(Request.PhysicalApplicationPath + "XMLFile.xml")
GridView1.DataSource = oDs
End Sub
End Class

At the Page_Load event we create a new DataSet and use the method ReadXml to get the data from the XML-file. Then we bind the DataSet to the GridView

Please Check my answer if you help....
Thank You...


Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend