one button instead of 2

Jan 26, 2011 at 2:47 PM

This is what I currently do:

 

user chooses some dates and other info and then clicks submit.

after they click submit, that info is sent to a sqldatasource that populates a gridview and I use rendercontrol to export it as a excel file.

so the user doesn't actually see the gridview, i only enable it and disable it for exporting.

My problem:

This solution isnt a true excel file, it is only a html formatted file with a xls extension, which some users have trouble viewing.

 

My Question:

 

If I use the export to excel control, the button is disabled because the gridview doesn't contain any data upon page load.

Can I make the exporttoexcel button hidden and use another button to databind my gridview and then call the exporttoexcel control?

 

If so, how can I do it, or any other suggestions?