.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Exporting multiple gridviews in multiple excel tabs

Posted By:      Posted Date: September 07, 2010    Points: 0   Category :ASP.Net
Hi All, I am able to export multiple gridviews in a single excel worksheet My question is can I separate these gridviews in multiple tabs under the same excel file ? This is my current method under the link buttonprotected void lnkExport_Click(object sender, EventArgs e) { Response.Clear(); Response.Buffer = true; Response.AddHeader("content-disposition","attachement;filename=TrendAnalysisRpt"+StoreNum); Response.Charset = ""; Response.ContentType = "application/vnd.ms-excel"; StringWriter sw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); HtmlForm frm = new HtmlForm(); this.grd_Inj.Parent.Controls.Add(frm); this.grdBody_1.Parent.Controls.Add(frm); frm.Attributes["runat"] = "server"; frm.Controls.Add(this.grd_Inj); frm.Controls.Add(this.grdBody_1); frm.Controls.Add(this.grdBody_2); frm.Controls.Add(this.grdBody_3); frm.Controls.Add(this.grdBody_4); frm.Controls.Add(this.grdMonth); frm.Controls.Add(this.grdDay); frm.Controls.Add(this.grdHours); frm.Controls.Add(this.grdLengthOS); frm.RenderControl(hw); Response.Write(sw.ToString()); Response.End(); } Thanks again!    

View Complete Post

More Related Resource Links

Exporting Multiple GridViews To PDF in asp.net



I know how to export GridView to PDF, but how to export GridView two or three that are&n

Not able to open excel after exporting to excel, multiple times .


I am trying to export to excel using SSRS reports , its working fine with pdf ,but while exporting to excel ,if i want to export multiple times the excel is not opening after 2-3 times. I am using MS Excel 2010. Help me....





Excel 2007 Filter on multiple values

Hi Everyone,How do I use Excel 2007 Pivot Table's label filters/value filters to filter with multiple conditions? for example, I want to get all customers with customer name start with "G" and doesn't include "E" and with measure>100 and measure between 50-60.Regards,George

Importing Excel with multiple worksheets via MVC

Is there a way wherein I could import data from multiple sheets of an excel file?  Thanks in advance...

Multiple Tabs

I have an application and if a user has multiple tabs open, they get kicked out and have to log in again. Is there something I need to set in IIS or the application to change that so they can have multiple tabs? I'm running IIS 7 win server 2008 and .net 3.5 

Enhance SSAS so that a calculation returns multiple cells at once (Excel fill not a single cell but

I wonder if somebody can help me with the following question. I would like to create an enhancement to SSAS in a way so that one can pass in multiple values, run a calculation and in return retrieves not one but multiple cell results at the same time e.g. retSet = functionABC(inSET) where inSet is somthing like 5 4 3 6 7 3 4 4 AND retSet is 4 6 7 8 9 3 4 4 All my calculated members in MDX return a single value BUT I need to have a calculation that if called returns multiple results (a set) at once and in a way so that Excel will properly pick up on it and consequently fills multiple cells in the Pivot table. Is that possible at all and if so how? I would not mind to write a little CLR assembly to enhance the SSAS but don't know how to pass the results back. Any ideas are highly appreciated. Dirk

Export Multiple Gridviews To Word

Hi, I am trying to export multiple gridviews to Word.  I am able to do this but what i want to do is add some headings and text in between each grivdiew.  Please see my code below i am using to export the gridviews.         Response.Buffer = True        Response.ContentType = "Application/vnd.ms-word"        Response.ContentEncoding = System.Text.Encoding.Default        Response.AddHeader("content-disposition", "attachment;filename=evaluation_report.doc")        EnableViewState = False        Dim oStringWriter As System.IO.StringWriter = New System.IO.StringWriter        Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter = New System.Web.UI.HtmlTextWriter(oStringWriter)         dv_course_information.RenderControl(oHtmlTextWriter)        gv_gp_practices.RenderControl(oHtmlTextWriter)        gv_attendance_summary.RenderControl(oHtmlTextWriter)        gv_useful_activities.RenderControl(oHtmlTextWriter)         Response.Write(oSt

Generating Multiple Excel Sheet using Reporting Services 2005.

<p> Hi, I'm currently developing a program using ASP.NET 2.0 (C#) and i am using Reporting Services 2005. One of the report requirements is to export a data to an excel with multiple excel sheet. Is there other way to generate multiple excel sheet using the reporting services? if yes, i would like to ask a sample code... Thanks in advance, JP  </p> 

ssis 2008 Loading MULTIPLE EXCEL file

HI it is possible for me to load multiple text file using for each loop,but if i try the same process for EXCEL file then my excel source throws an error. Also when i created my variable in value  i have given the path of my excel file ,still it didnt help me..because the moment i map the variable with the connection string of source excel connnection(property->expression->connection string) it start giving error if you could help me or provide some reference it will be of great help http://bi-polar23.blogspot.com/2007/08/loading-multiple-excel-files-with-ssis.html i tried this link but got stuck with it on step 12 and 14 (below  is my connection string) and variable is @Filename which i have created Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\mushtaq.sheikh\Desktop\ForEach\New Microsoft Excel Worksheet1.xlsx;Extended Properties="Excel 12.0;HDR=YES"; The moment i try to edit my connection string by comparing connection string provided in link it gives error(an OLEBD error has occured with error code 0x80040E73) on excel source Thanks in advance

import multiple Excel 2007 files using openrowset

hello, I Have a folder that includes multiple excle files (ver 2007), i am trying  to loop through each file using vbscript to import its data to sql 2000 using openrowset but i am getting this error in the openrowset line "[Microsoft][ODBC sql server driver] [sql server] [OLE/DB provider returned message: the microsoft office access DB engine cannot open or write to the file '', it is already open exclusively by another user or you need permission to view or write its data] code 80040E14 source microsoft OLEDB provider for ODBC drivers Any help please    

Excel data into multiple tables

Hi,       I  have excel file with columns EmpName,Date1,Date2,...Date7 .I want to insert EmpName into Employee table after inserting i will get EmpNo(Identity column) with that  i need to insert Date1,Date2...Date7 into TimeSheet table.    My Excel structure is like this EmpName  8/1/2010      8/2/2010     8/3/2010       8/4/2010    8/5/2010    8/6/2010 8/7/2010 Naresh    17:00-2:00   17:00-2:00   14:00-12:00  7:00-12:00  7:00-12:00  ..               Off Similarly 500 employees data I want to insert name i.e into Emp table after inserting i will get EMpNo i.e identity column with that i should insert Date1(8/1/2010) i.e excel header to date7 into Timesheet table Date column and corresponding time into TimeIn and TimeOut.I will split the time.I just want write Stored procedure for this task. My database tables are like this Emp-EmpNo,EmpName,CompaignId Timesheet-TimeID,EMpNo,Date,TimeIn,TimeOut,TotalHours   Date in Timesheet should be like this   TimeId     EmpNo     Date       TimeIn     TimeOut 

Creating Multiple Excel files Using SSIS

Hello Friends,  I have to create multiple excel files(Per Year eg 2008 , 2009, 2010....) from datatable using SSIS  For that i have to use one template excel file that is already created on some location.  Any help would be appreciated.  Thanks Thanks

How to merge sheets from multiple excel files into one .xls file?


 I have several excel spreadsheet fils, each of them contains multiple work sheets that may storing images or data.

 How could I merge all of these work sheets to just one .xls file and keep their original layout and style using asp.net?

 Thanks in advance.

Multiple ajaxcontrol tool kit tabs


I am using AjaxControlToolKit to generate tabs from one the forms. It has around 10 tabs that do not fit in one line. Is there a way to align AJAX tabs. Please help. I need to submit this by next month. I would appreciate itFrown 

Is it possible to preserve viewstate when the user opens multiple browser tabs?


I want my users to be able to open multiple browser tabs and be able to switch back and forth between them.  If Viewstate is saved for each page, I should be able to do this right?



Merging Multiple Excel files (exports from Reporting Services)


So we have Office 2007 on our system and I'm trying to use Excel Interop to take a number of Excel files, which are exports from Reporting Services, and combine them into one large workbook.  I'm using the code below which works fine to get all the information from all the files into one workbook but the colors of things goes absolutely haywire.  Anyone know why my colors are getting all out of wack?

protected void MergeFiles(string destinationFile, string[] sourceFiles, string guid)
                //1. Validate folder,  
                //2. Instantiate excel object  
                //3. Loop through the files  
                //4. Add sheets  
                //5. Save and enjoy!  


SSRS Export to Excel Multiple Sheets empty First Row


I have a report with four tables. There are page breaks in between each table (the Insert Page Break After this table option is selected on the first three tables). When I export this report to Excel, there are four sheets with the four tables of data on them. The 2nd, 3rd and 4th sheets all have the first row empty and its height is set to 0 so it looks like rwo 2 is the first one but row 1 is actually hidden. I need this row and would like the data to be populated in the first row and not the second. Has anyone come across this before?


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend