Hi,
On WebExporerBar clicked action, i am exporting the grid data into the Excel,
but On exporting the data i am getting the ThreadAbortException,
while my data is exported into the file.
after this if i clicked on any other ExplorerBar action it always give me "export to excel" action
Why does this problem?
how can i remove this problem?
[System.Threading.ThreadAbortException] = {Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.}
<ig:WebExcelExporter ID="gridExporter" runat="server" ExportMode="Download" EnableStylesExport="false" DataExportMode="AllDataInDataSource">
<ig:WebExplorerBar ID="ActionItemPanel" runat="server" GroupExpandBehavior="SingleExpanded" BorderStyle="None" EnableExpandButtons="False" EnableHotTracking="False" EnableSelection="False" GroupExpandAction="ButtonClick" ItemIndent="2px" EnableViewState="False" AutoPostBackFlags-ItemClick="On"> <Groups><ig:ExplorerBarGroup Text="Actions"> <Items> <ig:ExplorerBarItem Text="export to excel"> </ig:ExplorerBarItem> <ig:ExplorerBarItem Text="Item 2"> </ig:ExplorerBarItem> <ig:ExplorerBarItem Text="Item 3"> </ig:ExplorerBarItem> <ig:ExplorerBarItem Text="Item 4" > </ig:ExplorerBarItem> <ig:ExplorerBarItem Text="Item 5"> </ig:ExplorerBarItem> </Items> </ig:ExplorerBarGroup></Groups> </ig:WebExplorerBar>
protected void Page_Load(object sender, EventArgs e) { ExplorerBarPanel.ItemClick += new Infragistics.Web.UI.NavigationControls.ExplorerBarItemClickEventHandler(ExplorerBarPanel_ItemClick); DataTable dt = new DataTable(); dt.Columns.Add("col1", typeof(int)); dt.Columns.Add("col2", typeof(int)); dt.Columns.Add("col3", typeof(int)); dt.Columns.Add("col4", typeof(int)); for (int i = 0; i <= 50; i++) { dt.Rows.Add(new object[] { i, 1 + 1, 1 + 2, 1 + 3 }); } this.WebDataGrid1.DataSource = dt; this.WebDataGrid1.DataBind(); } protected void Button1_Click(object sender, EventArgs e) { this.eExporter.DownloadName = "ExportData"; this.eExporter.DataExportMode = Infragistics.Web.UI.GridControls.DataExportMode.AllDataInDataSource; this.eExporter.EnableStylesExport = false; this.eExporter.WorkbookFormat = Infragistics.Excel.WorkbookFormat.Excel2007; this.eExporter.Export(true, this.WebDataGrid1); } protected void ExplorerBarPanel_ItemClick(object sender, Infragistics.Web.UI.NavigationControls.ExplorerBarItemClickEventArgs e) { if(e.Item == null || e.Item is Infragistics.Web.UI.NavigationControls.ExplorerBarGroup) return; Button1_Click(null, null); }
Did you find a solution for this?
I'm getting ThreadAbortException when Exporting to Excel from a WebDataGrid. I have three web pages with the exact same C# code in their btnExport_Click event handler.
Two of them work, but the third fails with ThreadAbortException when this line executes:
this.WebExcelExporter1.Export(this.WebDataGrid1);
I understand that it's typically caused by Server.Transfer, Response.Redirect, etc. But that doesn't help me, since my code doesn't have any lines like that. Shabby.
I have the same problem with
this
.dExporter.Export(wdgCE);
I have the same problem.
I am getting the same "Thread Aborted Exception".
Please help...!!!
Hi All,
I will attempt to replicate this with a WebExplorerBar since that post has the most information. If anyone can get a full sample that replicates this, that would be most appreciated and help the process of finding out what the problem is.
regards,David Young
Hey,
So I have managed to reproduce the problem in the first post about it exporting on subsequent explorer bar clicks even if it is not the correct item. This is most likely a bug. I will repost the number if so. I could not get the Thread Aborted Exception, so if somebody could help me to reproduce that, I'll gladly take a look.
-Dave
Has anyone found a solution to this yet? My export code is as follows:
objExcelExporter.DownloadName = strFileName; objExcelExporter.ExportMode = ExportMode.Download; objExcelExporter.DataExportMode = DataExportMode.AllDataInDataSource; objExcelExporter.WorkbookFormat = Infragistics.Documents.Excel.WorkbookFormat.Excel97To2003; objExcelExporter.Export(true, WebDataGrid1);
Both my WebExcelExporter and WebDataGrid are surrounded by an UpdatePanel if that makes any difference, and the button that calls the export is an ImageButton in my PagerTemplate of the grid.
When the export button is clicked, an AsyncPostBack happens instead of a normal PostBack because my WebDataGrid is a trigger in the UpdatePanel (this is preferred).