Gridview Export to XML not formatting tags correctly..

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Apr 2008
Posts: 30
Reputation: Mapper99 is an unknown quantity at this point 
Solved Threads: 0
Mapper99 Mapper99 is offline Offline
Light Poster

Gridview Export to XML not formatting tags correctly..

 
0
  #1
Oct 23rd, 2008
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:
  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
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,160
Reputation: dickersonka will become famous soon enough dickersonka will become famous soon enough 
Solved Threads: 137
dickersonka dickersonka is offline Offline
Veteran Poster

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

 
0
  #2
Oct 27th, 2008
What are you wanting then?

Are you wanting the data or gridview to be written?

Also you are using htmltextwriter, which is exporting html.
Custom Application & Software Development
www.houseshark.net
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 30
Reputation: Mapper99 is an unknown quantity at this point 
Solved Threads: 0
Mapper99 Mapper99 is offline Offline
Light Poster

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

 
0
  #3
Oct 27th, 2008
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?
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,160
Reputation: dickersonka will become famous soon enough dickersonka will become famous soon enough 
Solved Threads: 137
dickersonka dickersonka is offline Offline
Veteran Poster

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

 
0
  #4
Oct 27th, 2008
Use the DataSet.WriteXml method.

Post the code you have where you set the datasource if you are having trouble still.
Custom Application & Software Development
www.houseshark.net
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC