<<
http://www.c-sharpcorner.com/Code/20...ridToExcel.asp
http://www.aspnetpro.com/NewsletterA...200309so_l.asp
http://weblogs.asp.net/dneimke/archi.../27/63348.aspx
http://www.mikepope.com/blog/AddComment.aspx?blogid=344>>
Ken,
I tried the one at the
weblogs.asp.net/dneimke/archive/2004/01/27/63348.aspx, which seems to be
generally like what I've got.
However, when I run it I still get a zero byte file that gives me a "Unable
to read file" message in Excel when I attempt to open it.
In stepping thru the code, which is EXACTLY like the one in the example,
with the exception that mine is not a private sub rendergrid that gets
called from a page load event, but rather the object of a
button_selectedindexchanged (a radio button) I have on the screen to choose
whether it's web (default) or Excel output.
After I step through the code, when the datagrid1.rendercontrol(hw) command
has executed, I do a quickwatch on it, and get this in the value field:
RenderControl Argument not specified for parameter 'writer' of 'Public Sub
RenderControl(writer As System.Web.UI.HtmlTextWriter)'.
A quickwatch on the next command, the response.write (tw.tostring()) is:
NewLine "" String
Also, the way I am doing my routine is in a couple of subs within my page.
I'm not calling either of the bindgrid or render controls in the pageload
event.
Any ideas?
SC