I pasted your second block of code below the first (as described in my previous email).
Here's what I got:
Error 1 The type or namespace name 'StringWriter' could not be found (are you missing a using directive or an assembly reference?)
Error 2 The type or namespace name 'TextWriter' could not be found (are you missing a using directive or an assembly reference?)
Error 3 The best overloaded method match for 'System.Web.UI.HtmlTextWriter.HtmlTextWriter(System.IO.TextWriter)' has some invalid arguments
Error 4 Argument '1': cannot convert from 'StringWriter' to 'System.IO.TextWriter'
Error 5 The best overloaded method match for 'ASP.xportxl_aspx.ExportGridView(System.Web.UI.WebControls.GridView, string, ASP.xportxl_aspx.ExportType)' has some invalid arguments
Error 6 Argument '1': cannot convert from 'string' to 'ASP.xportxl_aspx.ExportType'
Error 7 Argument '3': cannot convert from 'string' to c:\inetpub\wwwroot\intranet\XportXL.aspx 128 49
I tried adding various using directives (System, System.IO) at the start of the Script block, without any joy. I'm too new at this to know what to do and where to do it!
Please confirm/correct what I've done in VWD Express:
Add a Webform page to the site, specifying Visual C# as the Language to use.
Paste Ryan's First block of code between the
<script
runat="server">
and </script> at the top of the page - above the <head> tags.
Pase Ryans's second block of code after the first block.
Switch to Design View.
Add the Gridview (GridView1) to the page.
Add a Button above the Gridview.
Change the Button Text to "Export to Excel".
Double-click on the button in Design View.
Add ExportGridView("GridView1",
"Test.xls", "Excel"); between the braces.
Thanks very much, Ryan - I hope that you aren;t kicking yourself for responding to my email!
Regards
Gary
Gary Bartlett
gb at prodsol dot co dot nz
Gary Bartlett
gb at prodsol dot co dot nz
+64 9 473-9530
+64 21 776-390
http://www.prodsol.co.nz - Dramatic improvement through pattern-level intervention
GaryBartlett
Member
580 Points
116 Posts
Re: How To: Make "Export to Excel" always open excel in a separate Window
Feb 16, 2006 04:19 PM|LINK
Hi Ryan,
Thanks very much for the help!
I pasted your second block of code below the first (as described in my previous email).
Here's what I got:
Error 1 The type or namespace name 'StringWriter' could not be found (are you missing a using directive or an assembly reference?)
Error 2 The type or namespace name 'TextWriter' could not be found (are you missing a using directive or an assembly reference?)
Error 3 The best overloaded method match for 'System.Web.UI.HtmlTextWriter.HtmlTextWriter(System.IO.TextWriter)' has some invalid arguments
Error 4 Argument '1': cannot convert from 'StringWriter' to 'System.IO.TextWriter'
Error 5 The best overloaded method match for 'ASP.xportxl_aspx.ExportGridView(System.Web.UI.WebControls.GridView, string, ASP.xportxl_aspx.ExportType)' has some invalid arguments
Error 6 Argument '1': cannot convert from 'string' to 'ASP.xportxl_aspx.ExportType'
Error 7 Argument '3': cannot convert from 'string' to c:\inetpub\wwwroot\intranet\XportXL.aspx 128 49
I tried adding various using directives (System, System.IO) at the start of the Script block, without any joy. I'm too new at this to know what to do and where to do it!
Please confirm/correct what I've done in VWD Express:
Thanks very much, Ryan - I hope that you aren;t kicking yourself for responding to my email!
Regards
Gary
Gary Bartlett
gb at prodsol dot co dot nz
gb at prodsol dot co dot nz
+64 9 473-9530
+64 21 776-390
http://www.prodsol.co.nz - Dramatic improvement through pattern-level intervention