Web Wiz
Home
Home
Hosting Services
Hosting Services
Knowledgebase
Knowledgebase
Community and Support Forums
Support Forums
Customer Login
Customer Login

  New Posts New Posts RSS Feed - Need to export Gridview results to Excel
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Web Wiz Web Hosting 30 Day Free Trial

Windows Hosting 30 Day Free Trial, with no obligation, on all our Windows Web and Reseller Hosting Packages.

For moreĀ informationĀ see our Windows Hosting 30 Day Free Trial page.

Need to export Gridview results to Excel

 Post Reply Post Reply
Author
luwandui View Drop Down
Groupie
Groupie


Joined: 10 August 2011
Status: Offline
Points: 64
Post Options Post Options   Thanks (0) Thanks(0)   Quote luwandui Quote  Post ReplyReply Direct Link To This Post Topic: Need to export Gridview results to Excel
    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.

Thanks
Back to Top
s93ncer View Drop Down
Newbie
Newbie


Joined: 08 February 2006
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote s93ncer Quote  Post ReplyReply Direct Link To This Post 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/vnd.ms-excel"
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

...Spence
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



Become a Fan on Facebook Follow us on Twitter Web Wiz on Google+ Community Forums Web Wiz Blogs Web Wiz News
Company Information | Contact Web Wiz | Terms & Conditions | Privacy Policy

Prices exclude VAT unless otherwise stated - $, € prices shown as a guideline only
Web Wiz Ltd, Unit 10E Dawkins Road Ind. Est, Poole, Dorset, UK, BH15 4JD
Copyright ©2001-2012 Web Wiz - All rights reserved