FRIHOST • FORUMS • SEARCH • FAQ • TOS • BLOGS • COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Exporting Data From A Datalist To An Excel Sheet





umeshtangnu
I’m using this code to export data from a datagrid to an Excel sheet:

Code:
Response.Clear();
Response.Buffer= true;
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("Content-Disposition", "inline;filename=Clientes.xls");
Response.Charset = "";
this.EnableViewState = false;
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
DataGrid1.RenderControl(oHtmlTextWriter);
Response.Write(oStringWriter.ToString());
Response.End();


And this is working fine.
But now I want to do same with a datalist and thus I changed RenderControl line thus:

DataList1.RenderControl(oHtmlTextWriter);

Yet when Excel sheet is showing on screen, all data are displayed in one simple column “A”, with one row for each data in datalist.

Does somebody know how can I attain it work as I did as datagrd (each column in datalist into its respective column in Excel)?

I’ll appreciate your suggestions.
Related topics
New Data confirms a big earthquake in Central US
Exporting to Excel and formatting textarea
best phpmyadmin database exporting format
Microsoft vs. open-source in file sizes
Excel SpreadSheet to Website
SQL UPDATING TABLE
SQL script: String function how to?
visual basic 6 dataenvironment datalist
How to access MSSQL server ?
Importing email adresses to microsfot outlook, via excel lis
Open Office Calc Macros
Adri's New Year Resolution
Apartment Hunting - Application Process
Hoping for a response. NEED Help..
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.