Data Erasing while exporting to excel from gridview beside merge column

Hi All,

Below is the code to export to Excel

protected void btnExcel_Click(object sender, EventArgs e)



"content-disposition", "attachment;filename=FileName.xls");

Response.Charset = "";

// If you want the option to open the Excel file without saving then

// comment out the line below

// Response.Cache.SetCacheability(HttpCacheability.NoCache);

Response.ContentType = "application/vnd.xls";


StringWriter stringWrite = new System.IO.StringWriter();System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);





But while exporting the same content from gridview to  Excel,i mean the last row of the merge rows for 3rd cell & 4th cell i.e beside the merge cell is getting erased. for example

Notheast     2  0  1 1000

                     1  0  700

southwest   3  0  1 3500 

south         3  0  1 3500

                    1  0  2000

                    1   0  800 


summing     8   3   3  11,500

then 0 & 1 of last row is getting Erased while exporting to excel,but in gridvew it is showing correctly.

Help in this much appreciated.






11/12/2007 2:45:50 PM 72751 articles. 3 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 54

Make sure you have a value for every cell even if it's just a space like " "

A framework that allows you to dynamically load Silverlight modules into resizable draggable windows.
11/12/2007 10:13:51 PM

Similar Artilces:

Exporting in Excel without cells or excel columns merging for one column of data table(need sorting, data filters perfectly)
 Hi,   I have an issue with the excel exporting of the report using ssrs.  I am using only the body section for exporting to excel.  Here in the body i have an Image, Textbox(for Title), textbox2(for dates from,to) and below it i have a table having the columns used for showing the data.  The report gets generated but when i exported to excel, All the columns and rows in the excels sheets come close and its like there is no uniformity.  Few columsn of excel are covered under a single columsn of the data table.  So its making users feel uncomfortab...

How to export gridview data in excelexport data of gridview in excel?
dear friends i m using gridview with paging facility. can anyone tell me how do i export my gridview in excel? its urgent. thanks shwetaThanksshwetaIn a day when don't come across any problem -you can be sure that you are traveling in wrong path Hi please follow the link. Day Special SongASP.NET ListView Control hi thanks for d reply but the blog doesnt get open.  ThanksshwetaIn a day when don't come across any problem -you can be sure that you are traveling in wrong path It is opening at ...

Error Exporting Gridview data to excel Only when Gridview has template columns...[looking for work around]
Hello I have been exporting data to excel from a gridview using this code:   Protected Sub btnExportar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExportar.Click ExportToExcel(sender, e) End Sub Sub ExportToExcel(ByVal Source As Object, ByVal E As EventArgs) If Me.gvDesembolsos.Rows.Count.ToString + 1 < 65536 Then Me.gvDesembolsos.Enabled = False 'gvDesembolsos.Columns(1).Visible = False 'gvDesembolsos.Columns(7).Visible = False 'gvDesembolsos.Columns(9...

Handling control columns when exporting a GridView to Excel
Hi, I'm using this well published code to export the contents of a gridview to excel i nresponse to a button click, but in all nearly examples I've seen it gives the 'Must be between TAGS' error messege if there are any controls in the grid, my particular problem is there's tickbox's - here's the code =========================================================   Protected Sub ExportButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Dim stringWrite As New System.IO.StringWriter Dim htmlWrite As New System.Web.UI.HtmlTextWriter(stringWrite) 'This works as long as t...

i have work on gridview that i have as subject,bookname,link. in this some link column data are very large.according to that data(no spaces in that data)gridview has changed.i
hi,i have work on gridview that i have as subject,bookname,link. in this some link column data are very large.according to that data(no spaces in that data)gridview has changed.i want display half of the data and remaining display like this.(ex: can i display like this,and one more thing is always the column size will constant. Try something like this: <asp:templatefield headertext="Link"> <itemtemplate> <asp:hyperlink id="HyperLink1" runat="server" navigateurl='<...

Data presentation control in another Data presentation control
 Hello,I want to make a menu with datalist or gridview control.Basically,the menu will be like this,Categories     Sub Categories.For example, for COMPUTING category there will be NOTEBOOKS DESKTOPS etc.There will be a image for CATEGORIES and linkbuttons with Subcategories.If I put a datalist inside a datalist and a link button inside the second datalist visually it satisfies my need.However,CommandArguments come from database to linkbutton.Andwhen one of these command buttons is cliked it must go to proper page.I dont know how to wrie an event_handler ,specifically, for...

GridView control exporting to Excel in Net 2.0
Well, I did my homework and found 33,868 references to issues with the gridview control and Excel, none of which were close to whats happening with my app. I have a Gridview control on my VB.NET main page and when I right click on it the popup allows me to export to Excel just fine..5-6 columns, less than 100 rows..when I do the same on another page I get an Excel error popup : "This web query returned no data.."..both grids have a (Select) button in the 1st column. The one that works is simply that...the one that doesn't has the Button.Text defined as something e...

Control the language encoding for a data exported from gridview to Excel
Hello there, could anybody help me in this problem, I have a data that export to Excel but when it is exported any text that not in english will appear as rubbish.   please help me Hi:   Please open the exported file with notepad, what can you see in the <td>s? Please make sure these fields is Unicode encoding. Also try System.Web.HttpUtility.HtmlEncode(Eval("field_name")) instead of Eval("field_name") RegardsSincerely,Allen ChenMicrosoft Online Community SupportPlease remember to mark the replies as answers if they help and unmark them i...

merging rows for Ist & 2nd Cells in gridview And Erasing data in Excel
Hi All, In the Gridview it is showing correctly but when  we are exporting from gridview to excel then the last row beside merge cell is getting erased. i.e. 3rd & 4 th cell value getting erased.this problem arises when we are summing(adding) the 2nd cell.if we are doing summing for any cells then the data is not erasing in the excel.but extra cell is added for merge cell after the last cell. One more question,if we merging first cell no problem.but when we are merging 2nd cell,i think 2nd cell is merging is not done properly because extra cells is added after last ...

Is there a control that offers the same data presentation as a GridView, but allows users to copy and paste many rows/columns at once?
 Hi Is there a control that offers the same data presentation as a GridView, but allows users to copy and paste many rows/columns at once onto the grid? What I mean is some grid that 's as flexible as MS Excel grid for example.  Any suggestions will be very much appreciated.E The Repeater control is a highly customisable data presentation controlRohin.NET developerNever trust a computer you can't throw out a window. - Steve WozniakPlease remember to click on 'Mark as answer', if this post helped you......

Export SQL Query Data to Excel file and Prompt User to Save (Avoiding the user of controls like Gridview)
Hi All,I'm hoping someone maybe able to help with carrying out a select query which then is exported to excel where it prompts the end user to save avoiding:using any control such as gridview etc.not saving directly to the server.I found the following which grabs the query results and save to an .xls file directly onto the server but can't get it to prompt the user to download.Any help would be greatly appreciated! Code: (taken from;en-us;311194)//You use these variables throughout the application.     &n...

Issue with Template Columns & Bound Columns while updating the data in a GridView control
Hi, I'm facing the below problem (In general, ObjectDataSource is driving me crazy ! ) I have a simple gridview control and an ObjectDataSource is used to populate the grid. I'm trying to update a row and the corresponding tableadapter methods & stored procedure are in place. Each row has 2 checkboxes and 2 textboxes in edit mode. When the change the values in edit mode and hit update, the checkbox values changed are saved into the Database properly, whereas the textbox values are not being saved. If the textbox column is a bound column then the column is updated with <NULL> in...

binding a gridview to xmldatasource gives "The data source for gridview gridview1 did not have any properties or attributes from which to generate columns. Ensure that your data source has columns
Greetings!  I am new to forum so feel free to point me to the proper resources or forums.  I am using Visual Studio 2005.  I have a simple web page with a gridview control and an xmldatasource control.  I am getting the above error.  Can someone point out why I am getting the above error and what I need to do to resolve it?  Thanks in advance. /////////////////////////////// default.aspx  <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="default.aspx.vb" Inherits="XMLwalkthroughVB._default" %&...

Exporting Data from a Gridview to Excel
I know this is a common topic and I really have done my homework but I've spent hours on this and can't get it to work. When I click a button and run the sub below, I'm getting the error message "RegisterForEventValidation can only be called during Render" When I try and add <%@ Page Language="VB" EnableEventValidation="false" MasterPageFile="~masterurl/default.master" %> to the page directive, I get the error message "Parser Error Message: The enableeventvalidation attribute on the page directive is not allowed in this page....

Web resources about - Data Erasing while exporting to excel from gridview beside merge column -

Gas Exporting Countries Forum - Wikipedia, the free encyclopedia
The Gas Exporting Countries Forum ( GECF ) is an intergovernmental organization of 11 of the world's leading natural gas producers made up of ...

Facebook Updates Comments Box Plugin With Comment Exporting and Larger News Feed Stories
Facebook today released several updates to the newest version of its Comments Box social plugin for third party websites that will increase the ...

Lower dollar a boon for Canberra's wine exporting king
It may mean more expensive holidays for some, but one ACT registered company has enjoyed a profitable time thanks to the sharp fall in the Australian ...

Irish plant shut for exporting horsemeat
Sky News is Australia's leader in 24-hour news.

New online freight marketplace Cargohound aims to be the Uber of exporting
Cargo Hound wants to revolutionise the way goods are shipped from Australia.

Exporting the desperate; out of sight ... and mind
The boats have stopped, the point's been made, so why continue to treat those already ''here'' with such unconscionable cruelty?

Meat market: Andrew Forrest sees fortune in exporting beef to China
China is so desperate for good beef that Australian billionaire Andrew Forrest will be taking sample parcels of steak in his luggage on his next ...

Exporting carbon and hypocrisy: our big growth industry
Never mind our modest cuts to local emissions, new research shows Australia is heading into a carbon export boom.

Montreal men accused of illegally exporting railway equipment to Iran
Two Montreal men are charged with illegally exporting American-made railway equipment to Iran, violating Canada's Export and Import Permit Act ...

Lee Specialties Ltd. Charged With Exporting Prohibited Commodity To Iran
CALGARY - Putting the wrong address on a $15 shipment of synthetic rubber rings has cost an Alberta company $90,000 for violating legislation ...

Resources last updated: 12/3/2015 2:13:40 PM