473,503 Members | 1,869 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Exporting data to Excel, strange problem

1 New Member
I have an aspx page that retrieves data from several different sources and uses them to define a new GridView, which is the exported as an Excel file.

I originally had all of the code required in a single Page_Load sub. Once I worked out all of the standard problems that seem to trouble those of us trying to export to Excel, it was working fine. But now I need to make it so that it exports exports the GridView as an Excel file upon clicking a button. "Easy enough," I thought, "I'll just cut and paste that part of the code into a Button_Click sub." It's not working out at all though.

The Excel file it produces when I click the button is only 17 bytes long. It consists of <div> in cell A1 and </div> in cell A3 and nothing else. I've tried a hundred things but I can't seem to get this to work. I'm still somewhat new to ASP, so it may well be something simple and obvious I just don't know about. Any suggestions?

Thanks much.
Sep 28 '07 #1
2 1310
shweta123
692 Recognized Expert Contributor
Hi,

I dont get exact idea what may be wrong in the code

These are some useful links that may help you

Link1

Link2





I have an aspx page that retrieves data from several different sources and uses them to define a new GridView, which is the exported as an Excel file.

I originally had all of the code required in a single Page_Load sub. Once I worked out all of the standard problems that seem to trouble those of us trying to export to Excel, it was working fine. But now I need to make it so that it exports exports the GridView as an Excel file upon clicking a button. "Easy enough," I thought, "I'll just cut and paste that part of the code into a Button_Click sub." It's not working out at all though.

The Excel file it produces when I click the button is only 17 bytes long. It consists of <div> in cell A1 and </div> in cell A3 and nothing else. I've tried a hundred things but I can't seem to get this to work. I'm still somewhat new to ASP, so it may well be something simple and obvious I just don't know about. Any suggestions?

Thanks much.
Sep 29 '07 #2
jhardman
3,406 Recognized Expert Specialist
Site administrators have asked that I keep ASP.NET with the .NET forum so I have moved it over. Sorry for any confusion.

Jared, moderator
ASP forum
Oct 1 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
9521
by: Jeremy | last post by:
Hi, I have a webpage that is taking input from a form and using it as criteria to select data out of an sql database. The page displays an html table with the results. The user can then click a...
3
9217
by: sridevi | last post by:
Hello How to export data from ms-access database to excel worksheet using ASP. mainly i need to export data to multiple worksheets. it is very urgent to us. i have a sample code which works...
4
3930
by: D | last post by:
I've created a report with many subreports of aggregate data. I want my client to be able to export this data to Excel to make her charts, etc. Only one problem: one of the fields is a "SchoolYear"...
2
2298
by: pmud | last post by:
Hi, I am exporting data from an EDITABLE DATA GRID EXCEL. But the 1st column in data grid is Edit Column. I want to display all columns in Excel except for the Edit column. The following...
1
2293
by: NancyA | last post by:
I am using the following code to write data from a datagrid to an Excel file: Dim tw As New System.IO.StringWriter Dim hw As New System.Web.UI.HtmlTextWriter(tw) dg.RenderControl(hw)...
2
2389
by: bienwell | last post by:
Hi, I have a question about exporting data from datagrid control into Excel file in ASP.NET. On my Web page, I have a linkbutton "Export data". This link will call a Sub Function to perform...
2
3159
by: Snozz | last post by:
The short of it: If you needed to import a CSV file of a certain structure on a regular basis(say 32 csv files, each to one a table in 32 databases), what would be your first instinct on how to...
1
6943
by: 333sridhar333 | last post by:
Hi, I am having a problem in exporting a data from jsp to excel. I am getting the values from a servlet and populating it to a JSP. And form there i export them to Excel. The functionality...
2
3565
by: 333sridhar333 | last post by:
Hi, I am having a problem in exporting a data from jsp to excel. I am getting the values from a servlet and populating it to a JSP. And form there i export them to Excel. The functionality...
6
2168
by: jpatchak | last post by:
Hi, I have kind of a strange problem. I have a report that I need to export to excel. The report opens fine in Access and when I export it or click on "Analyze It with Microsoft Office Excel," I...
0
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7093
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7348
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7006
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5592
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5021
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
1519
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
397
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.