Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 6th, 2006, 07:45 AM
Authorized User
 
Join Date: Jan 2006
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default exporting to excel from datagrid

hello
i am dispalying certain records from sql into datagrid.now i hav provided checkboxes in datagrid to select item.
now i want to transfer those selected item into excel sheet.
(1)i don't want all the rows in datagrid to be transferred to exported to excel ,only those rows who are selected by checkbox shud go to excel sheet.
(2)and in my datagrid iam displaying only certain cloumns from the table in sql,but i want to export all the columns of the particular row which was selected in datagrid.

help me with solution in vb.net

  #2 (permalink)  
Old June 1st, 2006, 04:13 AM
Authorized User
 
Join Date: Oct 2004
Location: Bangalore, , India.
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default

My suggestion is,
Create a dynamic Datagrid and populate it with the data from database based on your selection. Then export it to Excel on the fly as follows

Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=FileName.xls");
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.No Cache);
Response.ContentType = "application/vnd.xls";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
this.ClearControls(datadrid);
datagrid.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();


Software proffesional from Bangalore,INDIA
  #3 (permalink)  
Old June 9th, 2006, 08:53 AM
Registered User
 
Join Date: Jun 2006
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
For the Excel functionality, there is a .net component called Spire.DataExport,Totally independent and not affiliated with and free download. I have heard that it is quite good for generating Excel files.
see: http://www.e-iceblue.com

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exporting data from datagrid to excel??? twyce C# 3 March 4th, 2010 04:51 AM
Problem in exporting data from datagrid to Excel deb_kareng ASP.NET 2.0 Professional 4 August 4th, 2007 09:21 AM
problem in exporting datagrid to excel swati_joshi ASP.NET 1.0 and 1.1 Professional 3 June 4th, 2006 11:26 PM
problem exporting datagrid to excel kscdave Classic ASP Professional 0 March 29th, 2005 11:57 AM
Exporting DataGrid To Excel chiefg C# 2 December 31st, 2003 12:23 PM



All times are GMT -4. The time now is 05:49 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.