Hi and TIA! I have a recordset retrieved into a datgrid in my web app, from
an SQL database that I want to save as an excel formatted file. I would
like the user to click a button, get a prompt to save/name the file. Is
this possible and if so where can I find information on accomplishing this
task. Any advice is appreciated. Using (.Net 1.1 / VS2003 / SQL Server
2000 / WinXP Pro). I posted to several groups cause not sure the best place
to ask the question.
Thanks for your time.


--

******************
Reggie

RE: Dataset to excel by amjad

amjad
Fri Jul 14 04:13:02 CDT 2006

try this code as i used it it worked perfect with c#
string sFilename="myexcel";
Response.ContentType = "application/vnd.ms-excel";
Response.AppendHeader("Content-Disposition", "attachment;filename=" +
sFilename);
Response.Charset = "";
// Turn off the view state.
this.EnableViewState = false;
System.IO.StringWriter tw=new StringWriter();
HtmlTextWriter hs=new HtmlTextWriter(tw);
this.MyGrid.RenderControl(hs);
Response.Write(tw.ToString());
Response.End();


"Reggie" wrote:

> Hi and TIA! I have a recordset retrieved into a datgrid in my web app, from
> an SQL database that I want to save as an excel formatted file. I would
> like the user to click a button, get a prompt to save/name the file. Is
> this possible and if so where can I find information on accomplishing this
> task. Any advice is appreciated. Using (.Net 1.1 / VS2003 / SQL Server
> 2000 / WinXP Pro). I posted to several groups cause not sure the best place
> to ask the question.
> Thanks for your time.
>
>
> --
>
> ******************
> Reggie
>
>
>

Re: Dataset to excel by Steve

Steve
Fri Jul 14 11:58:27 CDT 2006

I've detailed a variety of technique for Excel export here:
http://SteveOrr.net/articles/ExcelExport.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net


"Reggie" <NoSpam_chief123101@NoSpam_yahoo.com> wrote in message
news:GgHtg.339$OI5.218@fe07.lga...
> Hi and TIA! I have a recordset retrieved into a datgrid in my web app,
> from an SQL database that I want to save as an excel formatted file. I
> would like the user to click a button, get a prompt to save/name the file.
> Is this possible and if so where can I find information on accomplishing
> this task. Any advice is appreciated. Using (.Net 1.1 / VS2003 / SQL
> Server 2000 / WinXP Pro). I posted to several groups cause not sure the
> best place to ask the question.
> Thanks for your time.
>
>
> --
>
> ******************
> Reggie
>



Re: Dataset to excel by Reggie

Reggie
Fri Jul 14 21:14:29 CDT 2006

Steve, Exactly what I've been trying to accomplish. I'm a little new at
ASP.Net and the .Net Framework stuff, but I'm getting there. Thanks again
for you time and advice. Take care.

--

******************
Reggie
"Steve C. Orr [MVP, MCSD]" <Steve@Orr.net> wrote in message
news:%23BFd9a2pGHA.524@TK2MSFTNGP05.phx.gbl...
> I've detailed a variety of technique for Excel export here:
> http://SteveOrr.net/articles/ExcelExport.aspx
>
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> http://SteveOrr.net
>
>
> "Reggie" <NoSpam_chief123101@NoSpam_yahoo.com> wrote in message
> news:GgHtg.339$OI5.218@fe07.lga...
>> Hi and TIA! I have a recordset retrieved into a datgrid in my web app,
>> from an SQL database that I want to save as an excel formatted file. I
>> would like the user to click a button, get a prompt to save/name the
>> file. Is this possible and if so where can I find information on
>> accomplishing this task. Any advice is appreciated. Using (.Net 1.1 /
>> VS2003 / SQL Server 2000 / WinXP Pro). I posted to several groups cause
>> not sure the best place to ask the question.
>> Thanks for your time.
>>
>>
>> --
>>
>> ******************
>> Reggie
>>
>
>