943,565 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 3722
  • ASP.NET RSS
Oct 23rd, 2008
0

Gridview Export to XML not formatting tags correctly..

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

<tr>
<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>
<td>512135</td>
<td>5450865</td>
<td>CLOSED</td>
</tr>

Here is the code I am using to do the export:
ASP.NET Syntax (Toggle Plain Text)
  1. Response.ClearContent()
  2. Response.AddHeader("content-disposition", "attachment; filename=test.xml")
  3. Response.ContentType = "text/xml"
  4. Dim oStringWriter As New IO.StringWriter()
  5. Dim oHtmlTextWriter As New HtmlTextWriter(oStringWriter)
  6. GridView1.RenderControl(oHtmlTextWriter)
  7. Response.Write(oStringWriter.ToString)
  8. Response.End()

Am I taking the correct approach with this?

Thanks in advance,

M
Reputation Points: 10
Solved Threads: 0
Light Poster
Mapper99 is offline Offline
42 posts
since Apr 2008
Oct 27th, 2008
0

Re: Gridview Export to XML not formatting tags correctly..

What are you wanting then?

Are you wanting the data or gridview to be written?

Also you are using htmltextwriter, which is exporting html.
Reputation Points: 133
Solved Threads: 141
Veteran Poster
dickersonka is offline Offline
1,162 posts
since Aug 2008
Oct 27th, 2008
0

Re: Gridview Export to XML not formatting tags correctly..

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?
Reputation Points: 10
Solved Threads: 0
Light Poster
Mapper99 is offline Offline
42 posts
since Apr 2008
Oct 27th, 2008
0

Re: Gridview Export to XML not formatting tags correctly..

Use the DataSet.WriteXml method.

Post the code you have where you set the datasource if you are having trouble still.
Reputation Points: 133
Solved Threads: 141
Veteran Poster
dickersonka is offline Offline
1,162 posts
since Aug 2008
Jun 27th, 2011
0
Re: Gridview Export to XML not formatting tags correctly..
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...
Last edited by hello2222; Jun 27th, 2011 at 10:27 am.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
hello2222 is offline Offline
1 posts
since Jun 2011

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: simple local site search results in another frame (or page)
Next Thread in ASP.NET Forum Timeline: Retreive Real path from mapped drive





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC