473,499 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

lost footer values when exporting gridview to excel

Hello Everyone,

I have a gridview. I calculated some values in the gridview for the footer
of the gridview so basically I am adding all the values that are displayed in
the gridview for each column and displaying the total in the footer of the
gridview.
Now I export the gridview to excel spreadsheet with the code below.
Everything is exported well except the footer value become zero in the excel
spreadsheet. Can anyone tell me how can i fix this problem.
string attachment = "attachment; filename=Contacts.xls";
Response.ClearContent();
Response.AddHeader("content-disposition", attachment);
Response.ContentType = "application/ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
HtmlForm frm = new HtmlForm();
dgAgentActivity.Parent.Controls.Add(frm);
frm.Attributes["runat"] = "server";
frm.Controls.Add(dgAgentActivity);
frm.RenderControl(htw);
Any help will be greatly apprecaited.

Thanks.
Jul 24 '07 #1
0 1769

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2288
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
3626
by: manmit.walia | last post by:
Hello Fellow Developers, I have a small problem that you might be able to help me with. The method that I am trying to create is the ability to export a GridView and a image to word or excel. I...
0
1523
by: ChrisN | last post by:
My app displays a dataset in a GridView and also exports it to Excel. Characters with diacritical marks (eg umlaut) show up just fine in the GridView but are mangled when exported to Excel. Eg ...
4
2491
by: Tom | last post by:
I have a gridview on all of my web pages in my web app and they all export to excel. I have one page where the gridview is binding to a datatable that i created and only the first column is...
0
2646
by: gnewsgroup | last post by:
Well, I am trying to use the footer row of a GridView for insertion purpose. There are some articles about this, for example, the gridviewguy.com has an example, which always displays the footer...
0
1518
by: seanmatthewwalsh | last post by:
This should be REALLY straightforward. I have a gridview that allows editing, deleting and inserting (from the footer row). There is a Drop Down ListBox in the one column, which needs to ALWAYS set...
2
4203
by: ASF | last post by:
Hey all, I have a gridview with an objectdatasource. I've been using the below code to export to excel: gvITV.AllowSorting = False gvITV.DataBind() Dim tw As New IO.StringWriter() Dim hw As...
9
25689
by: svdoerga | last post by:
I am wondering how you can change the fontcolor in the header or footer in VBA when exporting to excel. I need some text in red. I found the ms page with the codes here. It's saying the formatting is...
1
208
by: Andrew Cooper | last post by:
I've got an ASP.NET page with a GridView connected to an Object Data Source. The GridView is working fine but my users would like the information to also be available in an Excel spreadsheet...
0
7134
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
7014
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
7180
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6905
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
7395
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4921
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
4609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3103
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1429
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 ...

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.