Print Page | Close Window

Need to export Gridview results to Excel

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
Printed Date: 29 November 2023 at 6:00am
Software Version: Web Wiz Forums 12.06 -

Topic: Need to export Gridview results to Excel
Posted By: luwandui
Subject: Need to export Gridview results to Excel
Date Posted: 07 September 2011 at 7:42am
I have a very simple asp page that shows the results of an SQL query in gridview. I would like to place button on the page that will allow the user to extract the data to excel. I need to do this in either asp or vb. Any suggestions would be appreciated.


-------------" rel="nofollow - Rosetta Stone Spanish

Posted By: s93ncer
Date Posted: 17 April 2012 at 8:23am
You could add a button to the page to postback to itself with a parameter

You could then check to that parameter and add something like

if request("parameter") = "excel" then response.ContentType="application/"
Then just write out your gridview - as long as the columns line up correctly it should work

I seem to remember if the user has excel installed then it will just open, otherwise it will ask the user to save the file


Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.06 -
Copyright ©2001-2023 Web Wiz Ltd. -