Exporting data to Excel, strange problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • austboss
    New Member
    • Sep 2007
    • 1

    Exporting data to Excel, strange problem

    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.
  • shweta123
    Recognized Expert Contributor
    • Nov 2006
    • 692

    #2
    Hi,

    I dont get exact idea what may be wrong in the code

    These are some useful links that may help you

    Link1

    Link2





    Originally posted by austboss
    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.

    Comment

    • jhardman
      Recognized Expert Specialist
      • Jan 2007
      • 3405

      #3
      Site administrators have asked that I keep ASP.NET with the .NET forum so I have moved it over. Sorry for any confusion.

      Jared, moderator
      ASP forum

      Comment

      Working...