I have some code which exports the contents of a gridview to XML. The XML is coming out with incorrect field tags:

<td>Builder Damage Inspection</td>
<td>request for final BDI inspection. No damage report on pre damage inspection.</td>
<td>2008-07-09 3:13:59 PM</td>
<td>2008-08-13 9:13:48 AM</td>

Here is the code I am using to do the export:

Response.AddHeader("content-disposition", "attachment; filename=test.xml")
Response.ContentType = "text/xml"
Dim oStringWriter As New IO.StringWriter()
Dim oHtmlTextWriter As New HtmlTextWriter(oStringWriter)

Am I taking the correct approach with this?

Thanks in advance,


Recommended Answers

All 4 Replies

What are you wanting then?

Are you wanting the data or gridview to be written?

Also you are using htmltextwriter, which is exporting html.

Thanks for your reply. I would like the data, not the html. Do you have a suggestion on how to export the output of a SQL data source instead?

Use the DataSet.WriteXml method.

Post the code you have where you set the datasource if you are having trouble still.

Yes i also find that how to export data from gridview to XML file

After lot of searching i founding at Export Data from Gridview to XML

Hope you enjoy...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.