Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.NET
i want to download gridview data to excel but i am getting error like this [System.Threading.ThreadAbortException] = {Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.}
here is code ..please tell me anyone
string filename = "DownloadMobileNoExcel.xls";
                                System.IO.StringWriter tw = new System.IO.StringWriter();
                                System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
                                GridExcelDetails.DataSource = GetTSubscriberDetails;
                                //Get the HTML for the control.
                                //Write the HTML back to the browser.
                                //Response.ContentType = application/;
                                Response.ContentType = "application/";
                                Response.AppendHeader("Content-Disposition", "attachment; filename=" + filename + "");
                                this.EnableViewState = false;

public override void VerifyRenderingInServerForm(Control control)
Posted 11-Dec-12 2:30am
Edited 11-Dec-12 2:32am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Advertise | Privacy | Mobile
Web04 | 2.8.141015.1 | Last Updated 11 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100