Web Wiz - Solar Powered Eco Web Hosting

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

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: 10
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

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.07
Copyright ©2001-2024 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Policy

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2024 Web Wiz Ltd. All rights reserved.