Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Sep 12, 2012 12:21 AM by Decker Dong - MSFT
Sep 07, 2012 03:37 PM|LINK
I've seen some articles on this forum on binding a gridview to an xml document. I'm looking to bind a gridview to a local xml file so that items in the file can be updated, added, and deleted via the gridview control. The XML file is in RSS format:
<?xml version="1.0" encoding="ISO-8859-1" ?>
Any help would be appreciated.
Sep 08, 2012 10:08 AM|LINK
To display RSS file in Gridview, check following and give xml file path:
To add/edit/delete, check following:
Sep 09, 2012 12:58 AM|LINK
I think you can make sure that your xml contents that can be converted to that of a DataTable type，and then bind to the GridView directly.
In fact you can download the sample：http://www.codeproject.com/Articles/18280/Edit-XML-files-using-a-GridView
Sep 11, 2012 06:41 PM|LINK
I've seen and tried many examples that can read an RSS format XML file, with code such as:
Dim ds as New DataSet
grid1.DataSource = ds.Tables(2)
But I'm having trouble with the code for adding an item to the file. Code such as:
dim dr as datarow
dr = ds.Tables("item").NewRow()
dr(0) = text1.text
dr(3) = text4.text
fails with: "Token StartElement in state Epilog would result in an invalid XML document"
I think the problem might be because of the rss format with additional <rss> and <channel> tags
Sep 12, 2012 12:21 AM|LINK
Sorry but I don't think a good idea to load rss feeds in the DataTable，maybe you should create a DataTable mapping to a certain physical table in a specific database，and then read this things out and output it in the form of XML.
Please read this：http://www.dotnettutorials.com/tutorials/advanced/rss-feed-asp-net-vb.aspx （You can read data with the help of SqlDataReader and then use this torturial to output xml contents）
Hope this helps & Reguards!