| | |
Gridview Export to XML not formatting tags correctly..
Please support our ASP.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
•
•
Join Date: Apr 2008
Posts: 29
Reputation:
Solved Threads: 0
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:
Am I taking the correct approach with this?
Thanks in advance,
M
<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)
Response.ClearContent() Response.AddHeader("content-disposition", "attachment; filename=test.xml") Response.ContentType = "text/xml" Dim oStringWriter As New IO.StringWriter() Dim oHtmlTextWriter As New HtmlTextWriter(oStringWriter) GridView1.RenderControl(oHtmlTextWriter) Response.Write(oStringWriter.ToString) Response.End()
Am I taking the correct approach with this?
Thanks in advance,
M
•
•
Join Date: Aug 2008
Posts: 1,158
Reputation:
Solved Threads: 136
What are you wanting then?
Are you wanting the data or gridview to be written?
Also you are using htmltextwriter, which is exporting html.
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
www.houseshark.net
•
•
Join Date: Aug 2008
Posts: 1,158
Reputation:
Solved Threads: 136
Use the DataSet.WriteXml method.
Post the code you have where you set the datasource if you are having trouble still.
Post the code you have where you set the datasource if you are having trouble still.
Custom Application & Software Development
www.houseshark.net
www.houseshark.net
![]() |
Other Threads in the ASP.NET Forum
- Previous Thread: What is web.config if we are using multiple languges in a website?
- Next Thread: SQL format exception
| Thread Tools | Search this Thread |
.net 3.5 activexcontrol advice ajax alltypeofvideos asp asp.net bc30451 beginner bottomasp.net browser businesslogiclayer c# c#gridviewcolumn cac checkbox class commonfunctions compatible confirmationcodegeneration content countryselector courier css dataaccesslayer database datagrid datagridview datagridviewcheckbox datalist deployment development dgv dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol fileuploader fill findcontrol flash formatdecimal forms formview gridview gudi homeedition iframe iis javascript jquery listbox microsoft mouse mssql multistepregistration nameisnotdeclared news objects opera panelmasterpagebuttoncontrols problem redirect registration relationaldatabases reportemail rotatepage schoolproject security sessionvariables silverlight smartcard smoobjects software sql sql-server sqlserver2005 ssl textbox tracking treeview unauthorized validatedate validation vb.net video videos virtualdirectory vista visualstudio web webapplications webdevelopemnt webdevelopment webprogramming webservice youareanotmemberofthedebuggerusers






