I have an aspx page that retrieves data from several different sources and uses them to define a new GridView, which is the exported as an Excel file.
I originally had all of the code required in a single Page_Load sub. Once I worked out all of the standard problems that seem to trouble those of us trying to export to Excel, it was working fine. But now I need to make it so that it exports exports the GridView as an Excel file upon clicking a button. "Easy enough," I thought, "I'll just cut and paste that part of the code into a Button_Click sub." It's not working out at all though.
The Excel file it produces when I click the button is only 17 bytes long. It consists of <div> in cell A1 and </div> in cell A3 and nothing else. I've tried a hundred things but I can't seem to get this to work. I'm still somewhat new to ASP, so it may well be something simple and obvious I just don't know about. Any suggestions?
Thanks much.
I originally had all of the code required in a single Page_Load sub. Once I worked out all of the standard problems that seem to trouble those of us trying to export to Excel, it was working fine. But now I need to make it so that it exports exports the GridView as an Excel file upon clicking a button. "Easy enough," I thought, "I'll just cut and paste that part of the code into a Button_Click sub." It's not working out at all though.
The Excel file it produces when I click the button is only 17 bytes long. It consists of <div> in cell A1 and </div> in cell A3 and nothing else. I've tried a hundred things but I can't seem to get this to work. I'm still somewhat new to ASP, so it may well be something simple and obvious I just don't know about. Any suggestions?
Thanks much.
Comment