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


Top 5 Contributors of the Month
abhays
satyapriyanayak
SP
Ashutosh Jha
ASPEvil
Post New Web Links

Export to excel

Posted By:      Posted Date: September 17, 2010    Points: 0   Category :ASP.Net
 
i have one gridview which I need to export it to excel , is there any way using VB  I 'm using the following code in the click event of a button on the page Response.ContentType = "application/vnd.ms-excel" ' Remove the charset from the Content-Type header. Response.Charset = "" ' Turn off the view state. Me.EnableViewState = FalseDim tw As New System.IO.StringWriter() Dim hw As New System.Web.UI.HtmlTextWriter(tw) ' Get the HTML for the control. GridView1.RenderControl(hw) ' Write the HTML back to the browser. Response.Write(tw.ToString()) ' End the response. Response.End()   but I'm getting the following error message "  Control 'ctl00_MainContent_GridView1' of type 'GridView' must be placed inside a form tag with runat=server. " anything I can do . thanks


View Complete Post


More Related Resource Links

Export Visio Database Table Names to Excel

  
If you use the Enterprise Architect edition of Microsoft Visio for data modeling regularly, then there is a good chance that at some point you've wanted to export just the table names into Excel. You might want to do this to map logical ERD entities to physical data model tables, track project status by entity, or track overlap between database versions.

Export SharePoint List to Excel Spreadsheet Programmatically using C#

  
In SharePoint applications, Custom Lists are used to store business data and Document Libraries to store the documents. But for data manupulation and analysis, Microsoft Excel provides very rich features as compared to SharePoint Lists. That's why people still loves to work on Microsoft Excel Sheets.

Export Gridview data to Excel sheet

  

Hi ,

     I have a requirement where i need to export the gridview data to excel.My code export the data in excel that was fine.

But the enchancement needed now , I was exporting the 3 gridview in same excel sheet under the workbook.

Now i need to export the 3 grid view in 3 different sheet in the same workbook.


so can please tell or share the updated code in my below code ...

public void writeovrsummary()
    {

Response.Write("<BR>");

        Response.Write("Overall Summary");
        //Response.Write("<BR>");
        //Response.Write("Report as of " + DateTime.Now.ToString("hh:mm ss tt"));

        StringWriter sw = new StringWriter();
        HtmlTextWriter hw = new HtmlTextWriter(sw);

        SqlCommand com = MyConnection.CreateCommand();
        com.CommandText = "useroverall_Report";
        SqlParameter[] par = new SqlParameter[1];
        par[0] = new

Export Dataset to excel sheet in a required format?

  

Hi,

I know how to export a grid view to excel.

But here i have a Dataset which consists of data like below and also it need to display in a required format like below.

pno psubno pstate pdetailid pdetails

 12    1          CA         1           cbsdjcbdjc     

12     1          CA          2        cndcnjdcjcj

12     2           VA         4          xcndwkfcgygry

13     1            AL        1           ncdcnjdcndj

My excel sheet  should like this.

pid       pstate     

 12/1      CA             &nb

export to excel issue

  

Hello ,

I have a browser enabled form which i published to sharepoint ..now i want to export the contents of the form to excel..i have 1 repeating table and two repeating sections ..whenever i go to export to excel and then choose just one repeating table or a repeating section or any option other than export all form data i get an error ...first the progress bar just freezes and then when i end the task through task m anager i get a msg that microsoft excel could not start.make sure excel is installed correctly and then try again....

Can somebody tell me how to debug this..i have tried the export of a form containg repeating table and sections and it works good ..so that means there is some problem with my form..so now can somebody give me an idea as to what can the problem be and how can i debug it.

Thanks


ASP.NET Excel Export Issue

  

Hi,

I am trying to export data from SP to a .xlsx sheet. Total no of rows is more  than 15000 with total of 13 columns.The data is generated with the help of SQL Server SP. Till this point it is working fine. However while exporting to excel I do not get any data , the excel  has blank content.

If I have records less than 12000 it generated the excel report with  relevant data. However as row increases the report is blank.

Also the excel is generated through the code but when I deploy to server and try to generate it generates a blank excel. 

 Please advice what needs to be done. I have tried multiple options but none works.


Export altered gridview to Excel

  

Hello... stuck on this one!!  In a gridview RowDataBound named gvwResult I am altering one of the cells with a value retrieved from the query.

I have added:

if (hdnExchangeTo.Value.ToString() != "1")
        {
            for (int i =0; i < gvwResult.Rows.Count; i++)
            {
                gvwResult.Rows[i].Cells[7].Text = ExchangeCurrency(gvwResult.Rows[i].Cells[7].Text.ToString());
            }
        }

to the common code to export to Excel:

        Response.Clear();
        Response.Buffer = true;
        Response.AddHeader("content-disposition","attachment;filename=Export.xls");
        Response.Charset = "";
        Response.ContentType = "application/vnd.ms-excel";
        System.IO.StringWriter sw = new Syste

How to do wide search and export the records to excel file in ASP.net C# ?

  

This is my MYSQL  database connection :-

public static OdbcConnection Connection = new OdbcConnection("Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=jdmcrm; User=root;Password=admin;");

My table name is "customer" and  fields liek customerId , companyName , address and date ;

How to do wide search and export the records to excel file ? im quite new in asp.net .

Pls advise . Thanks

 

 

 

 


Export to Excel

  
How can  I create hidden columns in SQL Server Reporting Services 2005 to be rendered as excel? Thanks in advance

VS2008 BIDS Report export to Excel not grouping the same as VS2005

  
I have a report that I created in VS2005 BIDS and got it to export to Excel to group/subtotal the same way it does in the BIDS report window.  Now I have copied the .rdl files to a VS2008 project, open it in VS2008 BIDS, made NO changes to the report format and the exported Excel file is combining what should be the 2nd and 3rd groups into 1 group.  In the BIDS window, the grouping is working correctly.  Does anyone have any ideas what has changed between 2005 & 2008 that may cause this problem?  Thanks in advance.    

String Data missing start from "+" When Export Data To Excel Using Gridview

  
Hi,I am exporting data from gridview to excel file.My problem is that for all the string which contain "+", the rest of data begining from it is missing in excel file.For example: PWE-WER+78, when exported it will become PWE-WER.Below is my code.                Response.ClearContent() Response.Buffer = True Response.AddHeader("Content-Disposition", "attachment;filename=" & "ExportedExcel.xls") Response.ContentType = "application/vnd.ms-excel" Response.Charset = "" lobjStringWriter = New StringWriter lobjHtmlWriter = New HtmlTextWriter(lobjStringWriter) dgdResult.RenderControl(lobjHtmlWriter) Response.Write(lobjStringWriter.ToString()) Response.End() I  have search through online but no solution.Does anyone has idea on this?

In export, i want to disable column in excel sheet

  
Hello, I am doing Import/Export. While export i want to disable some column in excel sheet, so during upload or import same primary key I can use, instead of user modify such column. Regards, Sandeep    

how to export the gridview1 in asp.net/c# into excel

  
i m having the datatable a        b12      1213       ukhdfukand how to export that to excel file.

Export to (pdf, excel, etc...)

  
I can't seem to find any support for exporting data to an excel file. Everything I have found regarding this topic refers to asp.net webform controls...Any suggestions?
Categories: 
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